Преглед изворни кода

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 пре 6 година
родитељ
комит
c631951ef5
1 измењених фајлова са 3 додато и 1 уклоњено
  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);