fix some slow memory leaks in the vacuuming handler in the recovery
authorRonnie Sahlberg <ronniesahlberg@gmail.com>
Mon, 15 Sep 2008 21:55:57 +0000 (07:55 +1000)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Mon, 15 Sep 2008 21:55:57 +0000 (07:55 +1000)
daemon

server/ctdb_recoverd.c

index af1c358ff055ec9bf802f2ee7ac73b713d63c29f..779d26f3e450616eeebf6ed1241cf8c496c1461c 100644 (file)
@@ -880,6 +880,7 @@ static void vacuum_fetch_handler(struct ctdb_context *ctdb, uint64_t srvid,
        r = (struct ctdb_rec_data *)&recs->data[0];
 
        if (recs->count == 0) {
+               talloc_free(tmp_ctx);
                return;
        }
 
@@ -888,6 +889,7 @@ static void vacuum_fetch_handler(struct ctdb_context *ctdb, uint64_t srvid,
        for (v=rec->vacuum_info;v;v=v->next) {
                if (srcnode == v->srcnode && recs->db_id == v->ctdb_db->db_id) {
                        /* we're already working on records from this node */
+                       talloc_free(tmp_ctx);
                        return;
                }
        }
@@ -930,6 +932,7 @@ static void vacuum_fetch_handler(struct ctdb_context *ctdb, uint64_t srvid,
        v = talloc_zero(rec, struct vacuum_info);
        if (v == NULL) {
                DEBUG(DEBUG_CRIT,(__location__ " Out of memory\n"));
+               talloc_free(tmp_ctx);
                return;
        }
 
@@ -940,6 +943,7 @@ static void vacuum_fetch_handler(struct ctdb_context *ctdb, uint64_t srvid,
        if (v->recs == NULL) {
                DEBUG(DEBUG_CRIT,(__location__ " Out of memory\n"));
                talloc_free(v);
+               talloc_free(tmp_ctx);
                return;         
        }
        v->r =  (struct ctdb_rec_data *)&v->recs->data[0];
@@ -949,6 +953,7 @@ static void vacuum_fetch_handler(struct ctdb_context *ctdb, uint64_t srvid,
        talloc_set_destructor(v, vacuum_info_destructor);
 
        vacuum_fetch_next(v);
+       talloc_free(tmp_ctx);
 }