From 9efa72f5c83be3acb7c842d1555d756cdcbb46f0 Mon Sep 17 00:00:00 2001 From: Duncan Overbruck Date: Mon, 10 Feb 2020 13:11:47 +0100 Subject: [PATCH] lib/package_config_files.c: use _get_cstring_nocopy for sha256_orig --- lib/package_config_files.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/package_config_files.c b/lib/package_config_files.c index ac3b9d95..f42ff9d3 100644 --- a/lib/package_config_files.c +++ b/lib/package_config_files.c @@ -69,7 +69,8 @@ xbps_entry_install_conf_file(struct xbps_handle *xhp, xbps_object_t obj, obj2; xbps_object_iterator_t iter, iter2; const char *version = NULL, *cffile, *sha256_new = NULL; - char buf[PATH_MAX], sha256_cur[XBPS_SHA256_SIZE], *sha256_orig = NULL; + char buf[PATH_MAX], sha256_cur[XBPS_SHA256_SIZE]; + const char *sha256_orig = NULL; int rv = 0; assert(xbps_object_type(binpkg_filesd) == XBPS_TYPE_DICTIONARY); @@ -114,7 +115,7 @@ xbps_entry_install_conf_file(struct xbps_handle *xhp, "file", &cffile); snprintf(buf, sizeof(buf), ".%s", cffile); if (strcmp(entry_pname, buf) == 0) { - xbps_dictionary_get_cstring(obj2, "sha256", &sha256_orig); + xbps_dictionary_get_cstring_nocopy(obj2, "sha256", &sha256_orig); break; } } @@ -234,8 +235,6 @@ xbps_entry_install_conf_file(struct xbps_handle *xhp, } out: - if (sha256_orig) - free(sha256_orig); xbps_object_iterator_release(iter);