From: Amos Jeffries Date: Mon, 26 Nov 2012 08:32:02 +0000 (-0700) Subject: basic_msnt_auth: memory leaks X-Git-Tag: SQUID_3_2_4~32 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b3d3ea2c3124a618b28c45f24c0fa13714a25bb2;p=thirdparty%2Fsquid.git basic_msnt_auth: memory leaks Detected by Coverity scan (free). Issues: 740415, 740416 --- diff --git a/helpers/basic_auth/MSNT/confload.cc b/helpers/basic_auth/MSNT/confload.cc index cbb72d3e1e..339ee0438e 100644 --- a/helpers/basic_auth/MSNT/confload.cc +++ b/helpers/basic_auth/MSNT/confload.cc @@ -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; } diff --git a/helpers/basic_auth/MSNT/usersfile.cc b/helpers/basic_auth/MSNT/usersfile.cc index ef889e55c2..643e40fb96 100644 --- a/helpers/basic_auth/MSNT/usersfile.cc +++ b/helpers/basic_auth/MSNT/usersfile.cc @@ -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