Hi,

Here's a patch against ganglia-3.0.6.200802141157 that fixes a memory
leak when using user defined metrics with spoofing.

The problem was that the spmetric was being copied out, ignoring the
spheader.  The strings that were allocated inside the spheader were
dropped.

mh

--- ganglia-3.0.6.200802141157/gmond/gmond.c    2008-02-14 14:58:58.000000000 
-0500
+++ ganglia-3.0.6.200802141157.mod/gmond/gmond.c        2008-02-20 
11:46:23.000000000 -0500
@@ -831,11 +831,13 @@ Ganglia_message_save( Ganglia_host *host
   /* Copy in the data */
   // Yemi
   if(message->id == spoof_metric){
-    // Store data as regular gmetric in hash table!!
+      /* Store data as regular gmetric in hash table!!
+       * Free the Spoof-related strings.
+       */
 
-      metric->message.id = metric_user_defined;   
+      metric->message.id = metric_user_defined;
       metric->message.Ganglia_message_u.gmetric = 
message->Ganglia_message_u.spmetric.gmetric;
-
+      xdr_free(xdr_Ganglia_spoof_header, 
&message->Ganglia_message_u.spmetric.spheader);
 
   }else{
       memcpy(&(metric->message), message, sizeof(Ganglia_message));


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Ganglia-developers mailing list
Ganglia-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ganglia-developers

Reply via email to