Date: Wed, 11 Feb 2015 08:07:33 +0000 (UTC) From: Baptiste Daroussin <bapt@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r278563 - stable/10/usr.sbin/pkg Message-ID: <201502110807.t1B87XIH035869@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: bapt Date: Wed Feb 11 08:07:32 2015 New Revision: 278563 URL: https://svnweb.freebsd.org/changeset/base/278563 Log: MFC: r278172 Plug resources leak CID: 1125813 CID: 1125807 CID: 1125808 Modified: stable/10/usr.sbin/pkg/pkg.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/pkg/pkg.c ============================================================================== --- stable/10/usr.sbin/pkg/pkg.c Wed Feb 11 07:53:02 2015 (r278562) +++ stable/10/usr.sbin/pkg/pkg.c Wed Feb 11 08:07:32 2015 (r278563) @@ -375,8 +375,11 @@ load_fingerprints(const char *path, int return (NULL); STAILQ_INIT(fingerprints); - if ((d = opendir(path)) == NULL) + if ((d = opendir(path)) == NULL) { + free(fingerprints); + return (NULL); + } while ((ent = readdir(d))) { if (strcmp(ent->d_name, ".") == 0 || @@ -806,8 +809,11 @@ cleanup: close(fd_sig); unlink(tmpsig); } - close(fd_pkg); - unlink(tmppkg); + + if (fd_pkg != -1) { + close(fd_pkg); + unlink(tmppkg); + } return (ret); } @@ -851,7 +857,7 @@ bootstrap_pkg_local(const char *pkgpath, if (config_string(SIGNATURE_TYPE, &signature_type) != 0) { warnx("Error looking up SIGNATURE_TYPE"); - return (-1); + goto cleanup; } if (signature_type != NULL && strcasecmp(signature_type, "FINGERPRINTS") == 0) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201502110807.t1B87XIH035869>