Explorar o código

icmap: icmap_init_r() leaks if trie_create() fails

Thanks to Coverity for finding this

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
Christine Caulfield %!s(int64=6) %!d(string=hai) anos
pai
achega
c631951ef5
Modificáronse 1 ficheiros con 3 adicións e 1 borrados
  1. 3 1
      exec/icmap.c

+ 3 - 1
exec/icmap.c

@@ -195,8 +195,10 @@ cs_error_t icmap_init_r(icmap_map_t *result)
 	}
 
         (*result)->qb_map = qb_trie_create();
-	if ((*result)->qb_map == NULL)
+	if ((*result)->qb_map == NULL) {
+		free(*result);
 		return (CS_ERR_INIT);
+	}
 
 	err = qb_map_notify_add((*result)->qb_map, NULL, icmap_map_free_cb, QB_MAP_NOTIFY_FREE, NULL);