When memory allocations for recovery fails,
authorRonnie Sahlberg <ronniesahlberg@gmail.com>
Fri, 3 Sep 2010 01:58:27 +0000 (11:58 +1000)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Fri, 3 Sep 2010 02:00:48 +0000 (12:00 +1000)
dont dereference a null pointer while trying to print the log message for the failure.

also shutdown ctdb with ctdb_fatal()

server/ctdb_recover.c

index e1c7b16e988678ce3ae853c08dc66c62963c7065..81e2d4b2eb4d7b1a1e97d8b29d4139459613b1c4 100644 (file)
@@ -340,10 +340,8 @@ static int traverse_pulldb(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data,
        }
        params->pulldata = talloc_realloc_size(NULL, params->pulldata, rec->length + params->len);
        if (params->pulldata == NULL) {
-               DEBUG(DEBUG_ERR,(__location__ " Failed to expand pulldb_data to %u (%u records)\n", 
-                        rec->length + params->len, params->pulldata->count));
-               params->failed = true;
-               return -1;
+               DEBUG(DEBUG_CRIT,(__location__ " Failed to expand pulldb_data to %u\n", rec->length + params->len));
+               ctdb_fatal(params->ctdb, "failed to allocate memory for recovery. shutting down\n");
        }
        params->pulldata->count++;
        memcpy(params->len+(uint8_t *)params->pulldata, rec, rec->length);