Rev 761: fixed a memory leak in the recovery daemon in http://samba.org/~tridge/ctdb

tridge at samba.org tridge at samba.org
Tue Jan 15 09:11:45 GMT 2008


------------------------------------------------------------
revno: 761
revision-id:tridge at samba.org-20080115091144-12pmym1loa06pmoa
parent: tridge at samba.org-20080115042807-iynlqnuo8oh5l6zf
committer: Andrew Tridgell <tridge at samba.org>
branch nick: tridge.stable
timestamp: Tue 2008-01-15 20:11:44 +1100
message:
  fixed a memory leak in the recovery daemon
modified:
  server/ctdb_recoverd.c         recoverd.c-20070503213540-bvxuyd9jm1f7ig90-1
=== modified file 'server/ctdb_recoverd.c'
--- a/server/ctdb_recoverd.c	2008-01-08 23:22:20 +0000
+++ b/server/ctdb_recoverd.c	2008-01-15 09:11:44 +0000
@@ -756,7 +756,13 @@
 		}
 
 		data = tdb_fetch(v->ctdb_db->ltdb->tdb, call.key);
-		if (data.dptr == NULL || data.dsize < sizeof(struct ctdb_ltdb_header)) {
+		if (data.dptr == NULL) {
+			tdb_chainunlock(v->ctdb_db->ltdb->tdb, call.key);
+			continue;
+		}
+
+		if (data.dsize < sizeof(struct ctdb_ltdb_header)) {
+			free(data.dptr);
 			tdb_chainunlock(v->ctdb_db->ltdb->tdb, call.key);
 			continue;
 		}
@@ -764,10 +770,13 @@
 		hdr = (struct ctdb_ltdb_header *)data.dptr;
 		if (hdr->dmaster == v->rec->ctdb->pnn) {
 			/* its already local */
+			free(data.dptr);
 			tdb_chainunlock(v->ctdb_db->ltdb->tdb, call.key);
 			continue;
 		}
 
+		free(data.dptr);
+
 		state = ctdb_call_send(v->ctdb_db, &call);
 		tdb_chainunlock(v->ctdb_db->ltdb->tdb, call.key);
 		if (state == NULL) {



More information about the samba-cvs mailing list