From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 5A3E61382C5 for ; Wed, 28 Feb 2018 18:44:58 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 59E6BE0809; Wed, 28 Feb 2018 18:44:57 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 376ACE0809 for ; Wed, 28 Feb 2018 18:44:57 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 5EEE4335C38 for ; Wed, 28 Feb 2018 18:44:56 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id D69BE21D for ; Wed, 28 Feb 2018 18:44:49 +0000 (UTC) From: "Fabian Groffen" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Fabian Groffen" Message-ID: <1519835350.d2ac9484a50843e9996df1f3f7dfd3eb0eb6ed85.grobian@gentoo> Subject: [gentoo-commits] repo/proj/prefix:master commit in: scripts/rsync-generation/ X-VCS-Repository: repo/proj/prefix X-VCS-Files: scripts/rsync-generation/hashgen.c X-VCS-Directories: scripts/rsync-generation/ X-VCS-Committer: grobian X-VCS-Committer-Name: Fabian Groffen X-VCS-Revision: d2ac9484a50843e9996df1f3f7dfd3eb0eb6ed85 X-VCS-Branch: master Date: Wed, 28 Feb 2018 18:44:49 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: c4a675ff-aedc-4522-b711-c068ee4be51f X-Archives-Hash: d254ca4779acc141a9633be36e731add commit: d2ac9484a50843e9996df1f3f7dfd3eb0eb6ed85 Author: Fabian Groffen gentoo org> AuthorDate: Wed Feb 28 16:29:10 2018 +0000 Commit: Fabian Groffen gentoo org> CommitDate: Wed Feb 28 16:29:10 2018 +0000 URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=d2ac9484 scripts/rsync-generation/hashgen: properly free members of lists scripts/rsync-generation/hashgen.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/scripts/rsync-generation/hashgen.c b/scripts/rsync-generation/hashgen.c index a4df7ca850..3f7aaf65d6 100644 --- a/scripts/rsync-generation/hashgen.c +++ b/scripts/rsync-generation/hashgen.c @@ -1093,7 +1093,11 @@ verify_dir( curdentry++; } } + + while (dentrieslen-- > 0) + free(dentries[dentrieslen]); free(dentries); + return ret; } else { return 1; @@ -1205,6 +1209,9 @@ verify_manifest(const char *dir, const char *manifest) qsort(elems, elemslen, sizeof(elems[0]), compare_elems); snprintf(buf, sizeof(buf), "%s/%s", dir, manifest); ret = verify_dir(dir, elems, elemslen, 0, buf + 2); + + while (elemslen-- > 0) + free(elems[elemslen]); free(elems); return ret; @@ -1213,7 +1220,6 @@ verify_manifest(const char *dir, const char *manifest) static char * process_dir_vrfy(const char *dir) { - char *ret = NULL; char buf[8192]; int newhashes; @@ -1222,8 +1228,7 @@ process_dir_vrfy(const char *dir) if ((newhashes = parse_layout_conf(buf)) != 0) { hashes = newhashes; } else { - fprintf(stderr, "verification must be done on a full tree\n"); - return "not on full tree"; + return "verification must be done on a full tree"; } if (chdir(dir) != 0) { @@ -1232,7 +1237,7 @@ process_dir_vrfy(const char *dir) } if (verify_gpg_sig(str_manifest) != 0) - ret = "gpg signature invalid"; + return "gpg signature invalid"; /* verification goes like this: * - verify the signature of the top-level Manifest file (done @@ -1240,12 +1245,12 @@ process_dir_vrfy(const char *dir) * - read the contents of the Manifest file, and process the * entries - verify them, check there are no files which shouldn't * be there - * - recurse into directories for which Manifest files are defined */ - + * - recurse into directories for which Manifest files are defined + */ if (verify_manifest(".\0", str_manifest) != 0) - ret = "manifest verification failed"; + return "manifest verification failed"; - return ret; + return NULL; } int