harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From odea...@apache.org
Subject svn commit: r694676 - /harmony/enhanced/jdktools/trunk/modules/samsa/src/main/native/samsa/samsa.c
Date Fri, 12 Sep 2008 10:52:48 GMT
Author: odeakin
Date: Fri Sep 12 03:52:48 2008
New Revision: 694676

URL: http://svn.apache.org/viewvc?rev=694676&view=rev
Log:
Fix fprintf call and ensure malloc'ed pToolData memory is not leaked.

Modified:
    harmony/enhanced/jdktools/trunk/modules/samsa/src/main/native/samsa/samsa.c

Modified: harmony/enhanced/jdktools/trunk/modules/samsa/src/main/native/samsa/samsa.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/samsa/src/main/native/samsa/samsa.c?rev=694676&r1=694675&r2=694676&view=diff
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/samsa/src/main/native/samsa/samsa.c (original)
+++ harmony/enhanced/jdktools/trunk/modules/samsa/src/main/native/samsa/samsa.c Fri Sep 12
03:52:48 2008
@@ -151,7 +151,7 @@
     pToolData = getToolData(toolName, root);
        
     if (pToolData == NULL) { 
-        fprintf(stderr, "Unable to get tool data for %s");
+        fprintf(stderr, "Unable to get tool data for %s", toolName);
         return 2;
     }
     
@@ -491,12 +491,13 @@
     char value[256];
     int count = 0;
     char *temp = NULL;
-    TOOLDATA *pToolData = (TOOLDATA *) malloc(sizeof(TOOLDATA));
+    TOOLDATA *pToolData = NULL;
             
     if (toolName == NULL || root == NULL) { 
         return NULL;
     }
-   
+
+    pToolData = (TOOLDATA *) malloc(sizeof(TOOLDATA));
     if (pToolData == NULL) { 
         return NULL;
     }
@@ -511,6 +512,7 @@
             + strlen(".dat") + 1);
                 
     if (temp == NULL) { 
+        free(pToolData);
         return NULL;
     }
     



Mime
View raw message