locking: Avoid memory leak in the failure case
authorAmitay Isaacs <amitay@gmail.com>
Tue, 2 Jun 2015 01:15:11 +0000 (11:15 +1000)
committerAmitay Isaacs <amitay@gmail.com>
Mon, 15 Jun 2015 02:13:01 +0000 (12:13 +1000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11293

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
(Imported from commit 2b352ff20597b9e34b3777d35deca1bf56209f8a)

server/ctdb_lock.c

index bcd899c3bb1310f8566d68e14cd9126e17865c2a..1d3e163d0ccf72ab094224915c1dc5d5b44a84d2 100644 (file)
@@ -917,6 +917,7 @@ static struct lock_request *ctdb_lock_internal(TALLOC_CTX *mem_ctx,
                if (lock_ctx->key.dptr == NULL) {
                        DEBUG(DEBUG_ERR, (__location__ "Memory allocation error\n"));
                        talloc_free(lock_ctx);
+                       talloc_free(request);
                        return NULL;
                }
                lock_ctx->key_hash = ctdb_hash(&key);