Ver código fonte

icmap: Free memory if qb_map_notify_add fails

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
Jan Friesse 1 ano atrás
pai
commit
2f19853bf4
1 arquivos alterados com 4 adições e 0 exclusões
  1. 4 0
      exec/icmap.c

+ 4 - 0
exec/icmap.c

@@ -201,6 +201,10 @@ cs_error_t icmap_init_r(icmap_map_t *result)
 	}
 
 	err = qb_map_notify_add((*result)->qb_map, NULL, icmap_map_free_cb, QB_MAP_NOTIFY_FREE, NULL);
+	if (err != 0) {
+		qb_map_destroy((*result)->qb_map);
+		free(*result);
+	}
 
 	return (qb_to_cs_error(err));
 }