]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
lib/audit_logging: Use talloc_stackframe() in audit_log_json()
authorAndrew Bartlett <abartlet@samba.org>
Fri, 14 Dec 2018 02:40:20 +0000 (15:40 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 14 Dec 2018 09:27:18 +0000 (10:27 +0100)
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
lib/audit_logging/audit_logging.c

index 644f72e09e129fa0578733cbb0f1295a54d656f0..42b93137c070a5b4014a28fb650cc1f75db1b112 100644 (file)
@@ -113,7 +113,7 @@ void audit_log_json(struct json_object* message,
                    int debug_class,
                    int debug_level)
 {
-       TALLOC_CTX *ctx = NULL;
+       TALLOC_CTX *frame = NULL;
        char *s = NULL;
 
        if (json_is_invalid(message)) {
@@ -121,12 +121,12 @@ void audit_log_json(struct json_object* message,
                return;
        }
 
-       ctx = talloc_new(NULL);
-       s = json_to_string(ctx, message);
+       frame = talloc_stackframe();
+       s = json_to_string(frame, message);
        if (s == NULL) {
                DBG_ERR("json_to_string returned NULL, "
                        "JSON audit message could not written\n");
-               TALLOC_FREE(ctx);
+               TALLOC_FREE(frame);
                return;
        }
        /*
@@ -138,7 +138,7 @@ void audit_log_json(struct json_object* message,
         * can find such lines by the leading {
         */
        DEBUGADDC(debug_class, debug_level, ("%s\n", s));
-       TALLOC_FREE(ctx);
+       TALLOC_FREE(frame);
 }
 
 /*