ctdb-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@samba.org>
Fri, 12 Jun 2015 10:40:54 +0000 (12:40 +0200)
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>
ctdb/server/ctdb_lock.c

index 3e5208e68671a6fcb48b960a7a7b21ddd78b8b69..2377ac0ef80a42bed38d5c8b82a5f6f825d88ab3 100644 (file)
@@ -906,6 +906,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);