Fix: fd-cache: Assertion failure if cache not allocated
[babeltrace.git] / src / fd-cache / fd-cache.c
index 9a742a4515028a554969ba7aec04d9b0ae2cdb10..c2907a04cb3880029f45bbfd4fbe9337f5757371 100644 (file)
@@ -120,13 +120,17 @@ int bt_fd_cache_init(struct bt_fd_cache *fdc, int log_level)
 BT_HIDDEN
 void bt_fd_cache_fini(struct bt_fd_cache *fdc)
 {
-       BT_ASSERT(fdc->cache);
+       if (!fdc->cache) {
+               goto end;
+       }
+
        /*
         * All handle should have been removed for the hashtable at this point.
         */
        BT_ASSERT(g_hash_table_size(fdc->cache) == 0);
        g_hash_table_destroy(fdc->cache);
 
+end:
        return;
 }
 
This page took 0.024514 seconds and 4 git commands to generate.