lib/audit_logging: actually create talloc
authorPhilipp Gesang <philipp.gesang@intra2net.com>
Tue, 18 Dec 2018 15:09:19 +0000 (16:09 +0100)
committerKarolin Seeger <kseeger@samba.org>
Fri, 1 Feb 2019 10:34:10 +0000 (11:34 +0100)
Heal damage of 79f494e51e..

That context is being passed around and freed but is never
actually allocated on that stack.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13737

Signed-off-by: Philipp Gesang <philipp.gesang@intra2net.com>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 5c928d7cd1d0ac994fe95892eec235b939ad2ec9)

lib/audit_logging/audit_logging.c

index 4ae18fb773b9f5f2bf74adbcc52224fc0cb872a7..3bb49f7cfc3b9ea6a934d17cc8410651c5b0f5e2 100644 (file)
@@ -245,6 +245,12 @@ void audit_message_send(
                return;
        }
 
+       ctx = talloc_new(NULL);
+       if (ctx == NULL) {
+               DBG_ERR("Out of memory creating temporary context\n");
+               return;
+       }
+
        /* Need to refetch the address each time as the destination server may
         * have disconnected and reconnected in the interim, in which case
         * messages may get lost