From 8d4a01baa415ac193b5f37a1cbc45822ca2b2333 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Tue, 7 Oct 2014 07:55:54 +0200 Subject: [PATCH] bin/xbps-checkvers/main.c: CID 62712 (NULL pointer dereference) --- bin/xbps-checkvers/main.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bin/xbps-checkvers/main.c b/bin/xbps-checkvers/main.c index 3be0e901..4d0609bd 100644 --- a/bin/xbps-checkvers/main.c +++ b/bin/xbps-checkvers/main.c @@ -95,6 +95,9 @@ map_create(void) { size_t i = 0; map_t *map = malloc(sizeof(map_t)); + if (map == NULL) + return NULL; + map->size = 16; map->len = 0; map->items = calloc(map->size, sizeof(map_item_t)); @@ -435,6 +438,10 @@ rcv_process_file(rcv_t *rcv, const char *fname, rcv_check_func check) const char *ehome; rcv->env = map_create(); + if (rcv->env == NULL) { + rcv->env = NULL; + return EXIT_FAILURE; + } rcv->have_vars = 0; if (!rcv_load_file(rcv, fname)) {