commit aecfe6973db3cf5c9ff2be0aa164eabfa50a60bb
parent 21cdab0fe225844753a0137872326960e83d9003
Author: Christian Grothoff <christian@grothoff.org>
Date: Thu, 28 Apr 2022 16:05:37 +0200
-fix recursive use-after-free case
Diffstat:
1 file changed, 19 insertions(+), 2 deletions(-)
diff --git 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;
}