]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
Some more debug and two memleak fixes
authorVolker Lendecke <vl@samba.org>
Tue, 17 Apr 2007 21:03:30 +0000 (23:03 +0200)
committerVolker Lendecke <vl@samba.org>
Tue, 17 Apr 2007 21:03:30 +0000 (23:03 +0200)
(This used to be ctdb commit 1e2802422794956827263265306952df5e69b377)

ctdb/common/ctdb_call.c
ctdb/common/ctdb_client.c
ctdb/lib/talloc/talloc.c
ctdb/tests/ctdb_fetch.c

index f89115b479f231cde1f85b707466a87b9738d413..4363b189cc45f192f6d722cc3be528c3454babf1 100644 (file)
@@ -422,7 +422,10 @@ void ctdb_reply_call(struct ctdb_context *ctdb, struct ctdb_req_header *hdr)
        struct ctdb_call_state *state;
 
        state = idr_find(ctdb->idr, hdr->reqid);
-       if (state == NULL) return;
+       if (state == NULL) {
+               DEBUG(0, ("reqid %d not found\n", hdr->reqid));
+               return;
+       }
 
        if (!talloc_get_type(state, struct ctdb_call_state)) {
                DEBUG(0,("ctdb idr type error at %s\n", __location__));
@@ -707,7 +710,10 @@ struct ctdb_call_state *ctdb_daemon_call_send(struct ctdb_db_context *ctdb_db,
        if (ret != 0) return NULL;
 
        if (header.dmaster == ctdb->vnn && !(ctdb->flags & CTDB_FLAG_SELF_CONNECT)) {
-               return ctdb_call_local_send(ctdb_db, call, &header, &data);
+               struct ctdb_call_state *result;
+               result = ctdb_call_local_send(ctdb_db, call, &header, &data);
+               talloc_free(data.dptr);
+               return result;
        }
 
        talloc_free(data.dptr);
index 1b5c80c6f47d252ef56ddd8439c3dc7fdc63211a..d14647ba9059d1963134ddcb548e605cae9ff715 100644 (file)
@@ -75,10 +75,15 @@ void ctdb_reply_fetch_lock(struct ctdb_context *ctdb, struct ctdb_req_header *hd
        struct ctdb_fetch_lock_state *state;
 
        state = idr_find(ctdb->idr, hdr->reqid);
-       if (state == NULL) return;
+       if (state == NULL) {
+               DEBUG(0, ("reqid %d not found at %s\n", hdr->reqid,
+                         __location__));
+               return;
+       }
 
        if (!talloc_get_type(state, struct ctdb_fetch_lock_state)) {
-               DEBUG(0, ("ctdb idr type error at %s\n", __location__));
+               DEBUG(0, ("ctdb idr type error at %s, it's a %s\n",
+                         __location__, talloc_get_name(state)));
                return;
        }
 
@@ -575,7 +580,7 @@ struct ctdb_record_handle *ctdb_fetch_lock(struct ctdb_db_context *ctdb_db, TALL
 
        talloc_set_destructor(h, fetch_lock_destructor);
 
-       ret = ctdb_ltdb_fetch(ctdb_db, key, &h->header, ctdb_db, data);
+       ret = ctdb_ltdb_fetch(ctdb_db, key, &h->header, h, data);
        if (ret != 0) {
                talloc_free(h);
                return NULL;
index 15a44bd0d99298661fe70a7f9957177507dc99ac..c8161fd63d2ac51c2a7a591a7fc915251dbd2d28 100644 (file)
@@ -1028,7 +1028,7 @@ static void talloc_report_null(void)
 /*
   report on any memory hanging off the null context
 */
-static void talloc_report_null_full(void)
+void talloc_report_null_full(void)
 {
        if (talloc_total_size(null_context) != 0) {
                talloc_report_full(null_context, stderr);
index 91fff3825dfc9c32215fd57afa88cc0c38164fd5..99fbe1fc5e2daf752dbda51194315e8749d304da 100644 (file)
@@ -142,6 +142,8 @@ static void bench_fetch(struct ctdb_context *ctdb, struct event_context *ev)
                        printf("Event loop failed!\n");
                        break;
                }
+
+               talloc_report_null_full();
        }
 
        printf("Fetch: %.2f msgs/sec\n", msg_count/end_timer());
@@ -193,6 +195,8 @@ int main(int argc, const char *argv[])
                }
        }
 
+       talloc_enable_leak_report_full();
+
        /* setup the remaining options for the main program to use */
        extra_argv = poptGetArgs(pc);
        if (extra_argv) {