]> granicus.if.org Git - curl/commit
asyn-thread: Fixed cleanup after OOM
authorDan Fandrich <dan@coneharvesters.com>
Mon, 28 Aug 2017 22:30:30 +0000 (00:30 +0200)
committerDan Fandrich <dan@coneharvesters.com>
Mon, 28 Aug 2017 22:35:19 +0000 (00:35 +0200)
commitdf29455dbce7f75f61339067c6f6ac43a9ff3fd7
treef746abb7ecb2eb88c497bf859f4e9873646d5150
parentedcb1ef60fdbbd3d78d9c9265f1ce63360e87d7b
asyn-thread: Fixed cleanup after OOM

destroy_async_data() assumes that if the flag "done" is not set yet, the
thread itself will clean up once the request is complete.  But if an
error (generally OOM) occurs before the thread even has a chance to
start, it will never get a chance to clean up and memory will be leaked.
By clearing "done" only just before starting the thread, the correct
cleanup sequence will happen in all cases.
lib/asyn-thread.c