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

Eddie Kohler kohler at cs.ucla.edu
Mon Sep 4 22:28:14 EDT 2006


Thanks!  Sorry for the delay -- checked in.

E


Bart Braem wrote:
> 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
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> click mailing list
> click at amsterdam.lcs.mit.edu
> https://amsterdam.lcs.mit.edu/mailman/listinfo/click



More information about the click mailing list