[Click] nsclick: clickclassifier new[] delete[] mismatch

Bart Braem bart.braem at ua.ac.be
Wed Jul 5 10:54:03 EDT 2006


Hello,

I noticed a large error in click-classifier.cc, both for ns-2.26 and ns-2.29. 
In the method void ClickClassifier::LinkLayerFailed(Packet* p) there is a new 
of the data array with new ... len[len] and it is deleted in the same method 
with a plain delete. This gave me a floating point error and of course it can 
be corrected with the patch below.

--- ns-2.29-patch.orig  2006-07-05 16:47:47.000000000 +0200
+++ ns-2.29-patch       2006-07-05 16:48:04.000000000 +0200
@@ -636,7 +636,7 @@
 +    simstate.curtime = GetSimTime();
 +    //fprintf(stderr,"Sending packet up to click...\n");
 +    
simclick_click_send(clickinst_,&simstate,ifid,clicktype,data,len,&simpinfo);
-+    delete data;
++    delete[] data;
 +    data = 0;
 +  }
 +  else {

Regards,
Bart
-- 
Bart Braem
PATS research group
Dept. of Mathematics and Computer Sciences
University of Antwerp
G2.36, Building G
Middelheimlaan 1
2020 Antwerpen, Belgium
Phone: +32 (0)3 265.35.19.
Fax: +32 (0)3 265.37.77.
Web: www.pats.ua.ac.be
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 307 bytes
Desc: not available
Url : https://amsterdam.lcs.mit.edu/pipermail/click/attachments/20060705/12bb3010/attachment.pgp


More information about the click mailing list