commit: 00bd72f7753299b7b4ba8da6d0471bf09f13b09f
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Tue Nov 15 03:02:01 2016 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Tue Nov 15 03:02:01 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=00bd72f7
qmerge: fix mem leak w/hash_file calls
qmerge.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/qmerge.c b/qmerge.c
index b734a87..8a5d329 100644
--- a/qmerge.c
+++ b/qmerge.c
@@ -588,6 +588,7 @@ merge_tree_at(int fd_src, const char *src, int fd_dst,
const char *dst,
/* syntax: obj filename hash mtime */
hash = hash_file_at(subfd_src, name, HASH_MD5);
fprintf(contents, "obj %s %s %"PRIu64"\n", cpath, hash,
(uint64_t)st.st_mtime);
+ free(hash);
/* Check CONFIG_PROTECT */
if (config_protected(cpath, cp_argc, cp_argv, cpm_argc,
cpm_argv)) {
@@ -1102,6 +1103,7 @@ pkg_unmerge(q_vdb_pkg_ctx *pkg_ctx, queue *keep)
/* If the file wasn't modified, unmerge
it */
unsigned char *hash =
hash_file_at(portroot_fd, e->name + 1, HASH_MD5);
protected = strcmp(e->digest, (const
char *)hash);
+ free(hash);
}
break;
@@ -1232,6 +1234,7 @@ pkg_verify_checksums(char *fname, const struct pkg_t
*pkg, const depend_atom *at
warn("MD5: [%sER%s] (%s) != (%s) %s/%s", RED,
NORM, hash, pkg->MD5, atom->CATEGORY, pkg->PF);
ret++;
}
+ free(hash);
}
if (pkg->SHA1[0]) {
@@ -1244,6 +1247,7 @@ pkg_verify_checksums(char *fname, const struct pkg_t
*pkg, const depend_atom *at
warn("SHA1: [%sER%s] (%s) != (%s) %s/%s", RED,
NORM, hash, pkg->SHA1, atom->CATEGORY, pkg->PF);
ret++;
}
+ free(hash);
}
if (!pkg->SHA1[0] && !pkg->MD5[0])