From 4c70b24941233abad215a6a8f688bb36a855d23d Mon Sep 17 00:00:00 2001 From: Juan RP Date: Mon, 2 Mar 2009 02:47:12 +0100 Subject: [PATCH] remove.c: check that required objs are in files.plist. --HG-- extra : convert_revision : a4e15ac3f48bf496d8671997b8e875c750b42730 --- lib/remove.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/remove.c b/lib/remove.c index f132ee79ad0..ccd417960b6 100644 --- a/lib/remove.c +++ b/lib/remove.c @@ -118,15 +118,18 @@ remove_pkg_files(prop_object_t obj, void *arg, bool *loop_done) (void)loop_done; - prop_dictionary_get_cstring_nocopy(obj, "file", &file); - if (file == NULL) + if (!prop_dictionary_get_cstring_nocopy(obj, "file", &file)) return EINVAL; path = xbps_append_full_path(false, rmcb->destdir, file); if (path == NULL) return EINVAL; - prop_dictionary_get_cstring_nocopy(obj, "type", &type); + if (!prop_dictionary_get_cstring_nocopy(obj, "type", &type)) { + free(path); + return EINVAL; + } + if (strcmp(type, "file") == 0) { prop_dictionary_get_cstring_nocopy(obj, "sha256", &sha256); rv = xbps_check_file_hash(path, sha256);