From: Amos Jeffries Date: Tue, 13 Nov 2012 11:51:19 +0000 (-0700) Subject: basic_msnt_auth: minor memory leaks X-Git-Tag: SQUID_3_4_0_1~520 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=470144f56e7e4a72fd21fe67c2ad840190717eff;p=thirdparty%2Fsquid.git basic_msnt_auth: minor 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 4184a51cce..eebf3001fe 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 81e8e3661c..64271d13cb 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