6969276: minor memory leak detected by cppcheck in agent/src/os/linux/symtab.c
authordsamersoff
Wed, 18 Dec 2013 23:09:57 +0400
changeset 22192 15caf5793272
parent 22191 f1b2f926ee72
child 22193 530963406a44
child 22194 e4bef4b8cdb4
6969276: minor memory leak detected by cppcheck in agent/src/os/linux/symtab.c Summary: missed free call on error return Reviewed-by: sla, sspitsyn, igerasim
hotspot/agent/src/os/linux/symtab.c
--- a/hotspot/agent/src/os/linux/symtab.c	Wed Dec 18 20:32:46 2013 +0400
+++ b/hotspot/agent/src/os/linux/symtab.c	Wed Dec 18 23:09:57 2013 +0400
@@ -214,8 +214,10 @@
                                 + 2);
   strcpy(debug_pathname, name);
   char *last_slash = strrchr(debug_pathname, '/');
-  if (last_slash == NULL)
+  if (last_slash == NULL) {
+    free(debug_pathname);
     return -1;
+  }
 
   /* Look in the same directory as the object.  */
   strcpy(last_slash+1, debug_filename);