ctdb-vacuum: If talloc_realloc fails, terminate traverse
authorAmitay Isaacs <amitay@gmail.com>
Thu, 10 Jul 2014 08:38:13 +0000 (18:38 +1000)
committerAmitay Isaacs <amitay@samba.org>
Wed, 23 Jul 2014 05:18:11 +0000 (07:18 +0200)
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
ctdb/server/ctdb_vacuum.c

index c7f052de59512923b7fe1da669a0cd5d9f636a4c..491103f8c3465d309f2d8e6a88cea30ea3d8fbbe 100644 (file)
@@ -307,7 +307,7 @@ static int delete_marshall_traverse(void *param, void *data)
        recs->records = talloc_realloc_size(recs, recs->records, old_size + rec->length);
        if (recs->records == NULL) {
                DEBUG(DEBUG_ERR,(__location__ " Failed to expand\n"));
-               return 0;
+               return -1;
        }
        recs->records->count++;
        memcpy(old_size+(uint8_t *)(recs->records), rec, rec->length);
@@ -1024,6 +1024,7 @@ static void ctdb_process_delete_list(struct ctdb_db_context *ctdb_db,
        if (ret != 0) {
                DEBUG(DEBUG_ERR, (__location__ " Error traversing the "
                      "delete list for second marshalling.\n"));
+               goto done;
        }
 
        indata.dsize = talloc_get_size(recs->records);