ctdb-locking: Check for talloc_memdup error
authorAmitay Isaacs <amitay@gmail.com>
Tue, 11 Mar 2014 07:57:08 +0000 (18:57 +1100)
committerMartin Schwenke <martins@samba.org>
Fri, 28 Mar 2014 02:30:09 +0000 (03:30 +0100)
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb/server/ctdb_lock.c

index c588c8b11692d5512ae694d00440cbf748da91d9..9d3b7c100343378fced0f85596d49f6ac51e0498 100644 (file)
@@ -927,6 +927,11 @@ static struct lock_request *ctdb_lock_internal(struct ctdb_context *ctdb,
                lock_ctx->key.dsize = key.dsize;
                if (key.dsize > 0) {
                        lock_ctx->key.dptr = talloc_memdup(lock_ctx, key.dptr, key.dsize);
+                       if (lock_ctx->key.dptr == NULL) {
+                               DEBUG(DEBUG_ERR, (__location__ "Memory allocation error\n"));
+                               talloc_free(lock_ctx);
+                               return NULL;
+                       }
                } else {
                        lock_ctx->key.dptr = NULL;
                }