------------------------------------------------------------ revno: 12387 revision-id: squid3@treenet.co.nz-20121118113333-fewvrx4y252wmyw4 parent: squid3@treenet.co.nz-20121118113233-jwrcg74br92ev85o committer: Amos Jeffries branch nick: 3.3 timestamp: Sun 2012-11-18 04:33:33 -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-20121118113333-fewvrx4y252wmyw4 # target_branch: http://bzr.squid-cache.org/bzr/squid3/3.3 # testament_sha1: 239890eb50c1fb70004d15f7194a3777123c29c4 # timestamp: 2012-11-18 11:39:16 +0000 # source_branch: http://bzr.squid-cache.org/bzr/squid3/3.3 # base_revision_id: squid3@treenet.co.nz-20121118113233-\ # jwrcg74br92ev85o # # Begin patch === modified file 'helpers/basic_auth/MSNT/confload.cc' --- helpers/basic_auth/MSNT/confload.cc 2012-07-02 12:14:07 +0000 +++ helpers/basic_auth/MSNT/confload.cc 2012-11-18 11:33:33 +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-07-02 12:14:07 +0000 +++ helpers/basic_auth/MSNT/usersfile.cc 2012-11-18 11:33:33 +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