Browse Source

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 năm trước cách đây
mục cha
commit
c631951ef5
1 tập tin đã thay đổi với 3 bổ sung1 xóa
  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);