diff options
author | Christian Grothoff <christian@grothoff.org> | 2022-04-28 16:05:37 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2022-04-28 16:05:37 +0200 |
commit | aecfe6973db3cf5c9ff2be0aa164eabfa50a60bb (patch) | |
tree | 183d45c0904d64ccc06fa177acd8326245163316 | |
parent | 21cdab0fe225844753a0137872326960e83d9003 (diff) | |
download | anastasis-aecfe6973db3cf5c9ff2be0aa164eabfa50a60bb.tar.gz anastasis-aecfe6973db3cf5c9ff2be0aa164eabfa50a60bb.tar.bz2 anastasis-aecfe6973db3cf5c9ff2be0aa164eabfa50a60bb.zip |
-fix recursive use-after-free case
-rw-r--r-- | src/reducer/anastasis_api_redux.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/reducer/anastasis_api_redux.c b/src/reducer/anastasis_api_redux.c index 2271942..1c770f1 100644 --- a/src/reducer/anastasis_api_redux.c +++ b/src/reducer/anastasis_api_redux.c @@ -545,7 +545,22 @@ notify_waiting (struct ConfigRequest *cr) w->state); abort_provider_config_cb (w); } +} + + +/** + * Notify anyone waiting on @a cr that the request is done + * (successful or failed). + * + * @param[in,out] cls request that completed + */ +static void +notify_waiting_cb (void *cls) +{ + struct ConfigRequest *cr = cls; + cr->tt = NULL; + notify_waiting (cr); } @@ -1157,8 +1172,10 @@ ANASTASIS_REDUX_add_provider_to_state_ (const char *url, w); if (NULL == cr->co) { - notify_waiting (cr); - return NULL; + if (NULL != cr->tt) + GNUNET_SCHEDULER_cancel (cr->tt); + cr->tt = GNUNET_SCHEDULER_add_now (¬ify_waiting_cb, + cr); } return &w->ra; } |