------------------------------------------------------------ revno: 11705 revision-id: squid3@treenet.co.nz-20121126083202-1atvaxpit5ynfef9 parent: squid3@treenet.co.nz-20121126083124-dchq357vks5w6gz9 committer: Amos Jeffries branch nick: 3.2 timestamp: Mon 2012-11-26 01:32:02 -0700 message: basic_msnt_auth: memory leaks Detected by Coverity scan (free). Issues: 740415, 740416 ------------------------------------------------------------ # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: squid3@treenet.co.nz-20121126083202-1atvaxpit5ynfef9 # target_branch: http://bzr.squid-cache.org/bzr/squid3/branches\ # /SQUID_3_2 # testament_sha1: cef6fc75025fb391db4ac430505665c27ee4b793 # timestamp: 2012-11-26 08:36:51 +0000 # source_branch: http://bzr.squid-cache.org/bzr/squid3/branches\ # /SQUID_3_2 # base_revision_id: squid3@treenet.co.nz-20121126083124-\ # dchq357vks5w6gz9 # # Begin patch === modified file 'helpers/basic_auth/MSNT/confload.cc' --- helpers/basic_auth/MSNT/confload.cc 2012-02-05 06:09:46 +0000 +++ helpers/basic_auth/MSNT/confload.cc 2012-11-26 08:32:02 +0000 @@ -85,6 +85,7 @@ Confbuf[2048] = '\0'; ProcessLine(Confbuf); } + fclose(ConfigFile); /* * Check that at least one server is being queried. Report error if not. @@ -95,7 +96,6 @@ syslog(LOG_ERR, "OpenConfigFile: No servers set in %s. At least one is needed.", CONFIGFILE); return 1; } - fclose(ConfigFile); return 0; } === modified file 'helpers/basic_auth/MSNT/usersfile.cc' --- helpers/basic_auth/MSNT/usersfile.cc 2012-02-05 06:09:46 +0000 +++ helpers/basic_auth/MSNT/usersfile.cc 2012-11-26 08:32:02 +0000 @@ -83,14 +83,17 @@ * 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