[Click] IPReassmbler gigantic memory leak

Eddie Kohler kohler at CS.UCLA.EDU
Tue Sep 21 15:33:00 EDT 2004


Hi Erwin,

> We're making a project frequently using IP fragmenting and
> reassembling. We're using Click, but there is a large memory leak in
> IPReassembler.

Holy god!  Try the attached diff, which is also checked in to CVS.  
Thanks for the bug report!!

Feeling stupid,
Eddie

-------------- next part --------------
Index: elements/ip/ipreassembler.cc
===================================================================
RCS file: /home/am0/click/cvsroot/release/one/elements/ip/ipreassembler.cc,v
retrieving revision 1.19
diff -u -u -r1.19 ipreassembler.cc
--- elements/ip/ipreassembler.cc	24 Jun 2004 00:03:58 -0000	1.19
+++ elements/ip/ipreassembler.cc	21 Sep 2004 19:31:37 -0000
@@ -270,6 +270,7 @@
     WritablePacket *q = find_queue(p, &q_pprev);
     if (!q) {			// make a new queue
 	make_queue(p, q_pprev);
+	p->kill();
 	return 0;
     }
     WritablePacket *q_bucket_next = (WritablePacket *)(q->next());
@@ -294,8 +295,8 @@
 	if (!(q = q->put(want_space))) {
 	    click_chatter("out of memory");
 	    *q_pprev = q_bucket_next;
-	    p->kill();
 	    _mem_used -= IPH_MEM_USED + old_transport_length;
+	    p->kill();
 	    return 0;
 	}
 	// get rid of extra space
@@ -355,6 +356,7 @@
 
     // Otherwise, done for now
     //check();
+    p->kill();
     return 0;
 }
 


More information about the click mailing list