]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
basic_msnt_auth: minor memory leaks
authorAmos Jeffries <squid3@treenet.co.nz>
Tue, 13 Nov 2012 11:51:19 +0000 (04:51 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Tue, 13 Nov 2012 11:51:19 +0000 (04:51 -0700)
Detected by Coverity scan (free). Issues: 740415, 740416

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

index 4184a51cce4dc3c6364bdb3aecbf79b41a57ee89..eebf3001fe76358dc1b4bed78861c5e2f02170a2 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 81e8e3661cd513d490305d23d29192c0e612f54f..64271d13cb283f2e6046c4431ae3d7e18a8c5065 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