Bug 1021142 - 'fclose()' at 2 places to avoid leaks on failure. r=bbondy
authorShashank Sabniveesu <shashank@linux.com>
Thu, 28 Aug 2014 11:35:50 -0700
changeset 223910 af568e909c625ca3c098ee2426fe51b6905b96fb
parent 223909 58c44d7982aff91f0ed210a1c4f4a3cd1f646620
child 223911 206fa95f0df30342cdfc88bb669ccfbbd2d6956f
push id3979
push userraliiev@mozilla.com
push dateMon, 13 Oct 2014 16:35:44 +0000
treeherdermozilla-beta@30f2cc610691 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbbondy
bugs1021142
milestone34.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1021142 - 'fclose()' at 2 places to avoid leaks on failure. r=bbondy
modules/libmar/src/mar_create.c
--- a/modules/libmar/src/mar_create.c
+++ b/modules/libmar/src/mar_create.c
@@ -231,24 +231,26 @@ refresh_product_info_block(const char *p
   for (i = 0; i < numAdditionalBlocks; ++i) {
     /* Get the position of the start of this block */
     oldPos = ftello(fp);
 
     /* Read the additional block size */
     if (fread(&additionalBlockSize, 
               sizeof(additionalBlockSize), 
               1, fp) != 1) {
+      fclose(fp);
       return -1;
     }
     additionalBlockSize = ntohl(additionalBlockSize);
 
     /* Read the additional block ID */
     if (fread(&additionalBlockID, 
               sizeof(additionalBlockID), 
               1, fp) != 1) {
+      fclose(fp);
       return -1;
     }
     additionalBlockID = ntohl(additionalBlockID);
 
     if (PRODUCT_INFO_BLOCK_ID == additionalBlockID) {
       if (fseeko(fp, oldPos, SEEK_SET)) {
         fprintf(stderr, "Could not seek back to Product Information Block\n");
         fclose(fp);