Fix process leak with make-network-process
commit2dd8044bfb61efc368c590b1285fdbca54606152
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 11 Aug 2016 18:24:54 +0000 (11 11:24 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 11 Aug 2016 18:26:34 +0000 (11 11:26 -0700)
treee080593b4e2183d66aeaaa6a0c406577f32a129a
parent2e0a2b376f51dd515ffeb6449181cc37fe912f5e
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.
src/process.c
src/process.h