diff options
| author | Paul Eggert | 2016-08-11 11:24:54 -0700 |
|---|---|---|
| committer | Paul Eggert | 2016-08-11 11:26:34 -0700 |
| commit | 2dd8044bfb61efc368c590b1285fdbca54606152 (patch) | |
| tree | e080593b4e2183d66aeaaa6a0c406577f32a129a /src/process.h | |
| parent | 2e0a2b376f51dd515ffeb6449181cc37fe912f5e (diff) | |
| download | emacs-2dd8044bfb61efc368c590b1285fdbca54606152.tar.gz emacs-2dd8044bfb61efc368c590b1285fdbca54606152.zip | |
Fix process leak with make-network-process
This problem was introduced by the recent async changes (Bug#23808).
* src/process.c (Fmake_process): Move USE_SAFE_ALLOCA later,
so that it follows the start_process_unwind unwind-protect.
Set pid to -1 while the process is being created.
(start_process_unwind): Omit unnecessary emacs_abort test.
(connect_network_socket): Simplify use of counts. Unwind
bind_polling_period a bit earlier, so that a remove_process
unwind-protect can be added when needed; this is the heart of
the fix. Undo the unwind-protect just before returning.
Diffstat (limited to 'src/process.h')
| -rw-r--r-- | src/process.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/process.h b/src/process.h index 6c227bc2266..9926050b9c3 100644 --- a/src/process.h +++ b/src/process.h | |||
| @@ -118,10 +118,11 @@ struct Lisp_Process | |||
| 118 | /* After this point, there are no Lisp_Objects any more. */ | 118 | /* After this point, there are no Lisp_Objects any more. */ |
| 119 | /* alloc.c assumes that `pid' is the first such non-Lisp slot. */ | 119 | /* alloc.c assumes that `pid' is the first such non-Lisp slot. */ |
| 120 | 120 | ||
| 121 | /* Number of this process. | 121 | /* Process ID. A positive value is a child process ID. |
| 122 | allocate_process assumes this is the first non-Lisp_Object field. | 122 | Zero is for pseudo-processes such as network or serial connections, |
| 123 | A value 0 is used for pseudo-processes such as network or serial | 123 | or for processes that have not been fully created yet. |
| 124 | connections. */ | 124 | -1 is for a process that was not created successfully. |
| 125 | -2 is for a pty with no process, e.g., for GDB. */ | ||
| 125 | pid_t pid; | 126 | pid_t pid; |
| 126 | /* Descriptor by which we read from this process. */ | 127 | /* Descriptor by which we read from this process. */ |
| 127 | int infd; | 128 | int infd; |