[Lsb-messages] /var/www/bzr/lsb/devel/build_env r2158: fix two coverity resource leak complaints

Mats Wichmann mats at linuxfoundation.org
Tue Sep 24 23:06:13 UTC 2013


------------------------------------------------------------
revno: 2158
committer: Mats Wichmann <mats at linuxfoundation.org>
branch nick: build_env
timestamp: Tue 2013-09-24 17:06:13 -0600
message:
  fix two coverity resource leak complaints
modified:
  lsbdev-cc/lsbcc.c
  package/Makefile
-------------- next part --------------
=== modified file 'lsbdev-cc/lsbcc.c'
--- a/lsbdev-cc/lsbcc.c	2012-12-01 01:06:48 +0000
+++ b/lsbdev-cc/lsbcc.c	2013-09-24 23:06:13 +0000
@@ -344,9 +344,10 @@
 
 /* begin utility functions */
 
-/* We need to figure out what the path to the gcc base directory is
- * This is one place where lsbcc is be more gcc-dependent than one
- * might like.
+/* We need to figure out the path to the compiler base directory.
+ * Unfortunately, we don't know how to do this in a compiler-independent way.
+ * This would need tweaking if a non-gcc compiler didn't recognize
+ * option -print-libgcc-file-name.
  */
 char *gccbasedir;
 
@@ -367,11 +368,12 @@
 
     if (fgets(buf, PATH_MAX, cccmd) == NULL) {
 	fprintf(stderr, "nothing to read from \"%s\"\n", cmd);
+	pclose(cccmd);
 	return;
     }
 
     gccbasedir = dirname(buf);
-
+    pclose(cccmd);
     return;
 }
 
@@ -884,6 +886,7 @@
 		    free((*dirents)[num_ents]);
 		}
 		free(*dirents);
+		closedir(dir);
 		errno = ENOMEM;
 		return -1;
 	    }
@@ -891,6 +894,7 @@
 	    num_ents++;
 	}
     }
+    closedir(dir);
     return num_ents;
 }
 

=== modified file 'package/Makefile'
--- a/package/Makefile	2013-09-20 11:44:53 +0000
+++ b/package/Makefile	2013-09-24 23:06:13 +0000
@@ -46,7 +46,7 @@
 
 # We define this here instead of directly in the spec file as
 # we need to be able to work out what the produced rpm files will be called
-RPM_PACKAGE_RELEASE=4
+RPM_PACKAGE_RELEASE=5
 
 # Initialize LIB64 to proper value for 64-bit architectures
 export LIB64:=$(shell case `uname -m` in (ppc64 | s390x | x86_64) echo 64 ;; esac)



More information about the lsb-messages mailing list