]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Add destructor so we can set a breakpoint for state ctx freeing
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 30 Apr 2020 01:18:22 +0000 (20:18 -0500)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 30 Apr 2020 01:19:11 +0000 (20:19 -0500)
src/lib/server/request.c

index b603d6225a80f70804d7a17b67f025f48b24140e..4fb035a4fa139896801ff8283da61ce03f143811 100644 (file)
@@ -34,6 +34,15 @@ RCSID("$Id$")
  */
 static _Thread_local fr_dlist_head_t *request_free_list; /* macro */
 
+#ifndef NDEBUG
+static int _state_ctx_free(TALLOC_CTX *state)
+{
+       DEBUG4("state-ctx %p freed", state);
+
+       return 0;
+}
+#endif
+
 /** Setup logging and other fields for a request
  *
  * @param[in] file             the request was allocated in.
@@ -62,7 +71,12 @@ static void request_init(char const *file, int line, REQUEST *request)
        /*
         *      Initialise the state_ctx
         */
-       if (!request->state_ctx) request->state_ctx = talloc_init_const("session-state");
+       if (!request->state_ctx) {
+               request->state_ctx = talloc_init_const("session-state");
+#ifndef NDEBUG
+               talloc_set_destructor(request->state_ctx, _state_ctx_free);
+#endif
+       }
 
        /*
         *      These may be changed later by request_pre_handler