8145698: Memory leak in add_lib_info_fd of libproc_impl.c:174
authordsamersoff
Sat, 16 Jan 2016 13:56:49 +0300 (2016-01-16)
changeset 35516 f0d335e847c5
parent 35491 663c609dfeee
child 35517 7d5ff5ee627c
8145698: Memory leak in add_lib_info_fd of libproc_impl.c:174 Summary: Added missed free call Reviewed-by: jbachorik, sspitsyn
hotspot/src/jdk.hotspot.agent/linux/native/libsaproc/libproc_impl.c
hotspot/src/jdk.hotspot.agent/macosx/native/libsaproc/libproc_impl.c
--- a/hotspot/src/jdk.hotspot.agent/linux/native/libsaproc/libproc_impl.c	Thu Jan 14 09:18:11 2016 +0100
+++ b/hotspot/src/jdk.hotspot.agent/linux/native/libsaproc/libproc_impl.c	Sat Jan 16 13:56:49 2016 +0300
@@ -171,6 +171,7 @@
 
    if (strlen(libname) >= sizeof(newlib->name)) {
      print_debug("libname %s too long\n", libname);
+     free(newlib);
      return NULL;
    }
    strcpy(newlib->name, libname);
--- a/hotspot/src/jdk.hotspot.agent/macosx/native/libsaproc/libproc_impl.c	Thu Jan 14 09:18:11 2016 +0100
+++ b/hotspot/src/jdk.hotspot.agent/macosx/native/libsaproc/libproc_impl.c	Sat Jan 16 13:56:49 2016 +0300
@@ -217,6 +217,7 @@
 
   if (strlen(libname) >= sizeof(newlib->name)) {
     print_debug("libname %s too long\n", libname);
+    free(newlib);
     return NULL;
   }
   strcpy(newlib->name, libname);