[Lsb-messages] /var/www/bzr/lsb/devel/build_env r2186: Fix inappropriate free (bug 3908).

Jeff Licquia licquia at linuxfoundation.org
Wed Jan 29 17:30:23 UTC 2014


------------------------------------------------------------
revno: 2186
committer: Jeff Licquia <licquia at linuxfoundation.org>
branch nick: build_env
timestamp: Wed 2014-01-29 12:30:23 -0500
message:
  Fix inappropriate free (bug 3908).
modified:
  lsbdev-cc/lsbcc.c
-------------- next part --------------
=== modified file 'lsbdev-cc/lsbcc.c'
--- a/lsbdev-cc/lsbcc.c	2014-01-02 16:38:30 +0000
+++ b/lsbdev-cc/lsbcc.c	2014-01-29 17:30:23 +0000
@@ -938,7 +938,18 @@
 		    strdup((dirents[num_libs]->d_name) + strlen("lib"));
 		*(strstr(libstr, ".so")) = '\0';
 		argvaddstring(lsblibs, libstr);
-		free(libstr);
+		/* 
+		 * Coverity will flag this as a leak, because we don't
+		 * free the strdup above; this is true, but it's not
+		 * a major concern.  We use this memory through the 
+		 * program's lifetime, and it doesn't grow without
+		 * bounds.  At some point, we should probably have
+		 * argvaddstring do the strdup itself and write a
+		 * cleanup function to do the right thing.  See bug
+		 * 3908 for the instance where this problem got caught,
+		 * and bug 3911 for the proper solution to all this.
+		 */
+		/* free(libstr); */
 	    }
 	    free(dirents);
 	} else {



More information about the lsb-messages mailing list