]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
basic_msnt_auth: memory leaks
authorAmos Jeffries <squid3@treenet.co.nz>
Mon, 26 Nov 2012 08:32:02 +0000 (01:32 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Mon, 26 Nov 2012 08:32:02 +0000 (01:32 -0700)
 Detected by Coverity scan (free). Issues: 740415, 740416

helpers/basic_auth/MSNT/confload.cc
helpers/basic_auth/MSNT/usersfile.cc

index cbb72d3e1e276e43518591c5c889818a01530226..339ee0438ea4c8d41a92efc818f35dc5f3e7fccb 100644 (file)
@@ -85,6 +85,7 @@ OpenConfigFile(void)
         Confbuf[2048] = '\0';
         ProcessLine(Confbuf);
     }
+    fclose(ConfigFile);
 
     /*
      * Check that at least one server is being queried. Report error if not.
@@ -95,7 +96,6 @@ OpenConfigFile(void)
         syslog(LOG_ERR, "OpenConfigFile: No servers set in %s. At least one is needed.", CONFIGFILE);
         return 1;
     }
-    fclose(ConfigFile);
     return 0;
 }
 
index ef889e55c29132ca91547db73a3047b3bd2cf6a4..643e40fb968b57888cfd4c4e9064911eb31eb1e7 100644 (file)
@@ -83,14 +83,17 @@ Read_usersfile(const char *path, usersfile * uf)
      * Clear the allowed user string. Return. */
     if (fstat(fileno(fp), &FileBuf) < 0) {
         syslog(LOG_ERR, "%s: %s", path, strerror(errno));
+        fclose(fp);
         return 1;
     }
     /* If it exists, save the modification time and size */
     uf->LMT = FileBuf.st_mtime;
 
     /* Handle the special case of a zero length file */
-    if (FileBuf.st_size == 0)
+    if (FileBuf.st_size == 0) {
+        fclose(fp);
         return 0;
+    }
 
     /*
      * Read the file into memory