projects
/
platform
/
upstream
/
isl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
isl_hmap_map_basic_set_set: avoid memory leak on error path
[platform/upstream/isl.git]
/
isl_hmap_map_basic_set.c
diff --git
a/isl_hmap_map_basic_set.c
b/isl_hmap_map_basic_set.c
index
b303516
..
09f7f60
100644
(file)
--- a/
isl_hmap_map_basic_set.c
+++ b/
isl_hmap_map_basic_set.c
@@
-78,7
+78,7
@@
int isl_hmap_map_basic_set_set(isl_ctx *ctx,
entry = isl_hash_table_find(ctx, &hmap->table, hash, &has_key, key, 1);
if (!entry)
entry = isl_hash_table_find(ctx, &hmap->table, hash, &has_key, key, 1);
if (!entry)
-
return -1
;
+
goto error
;
if (entry->data) {
pair = entry->data;
if (entry->data) {
pair = entry->data;
@@
-89,14
+89,15
@@
int isl_hmap_map_basic_set_set(isl_ctx *ctx,
}
pair = isl_alloc_type(ctx, struct isl_map_basic_set_pair);
}
pair = isl_alloc_type(ctx, struct isl_map_basic_set_pair);
- if (!pair) {
- isl_map_free(key);
- isl_basic_set_free(val);
- return -1;
- }
+ if (!pair)
+ goto error;
entry->data = pair;
pair->key = key;
pair->val = val;
return 0;
entry->data = pair;
pair->key = key;
pair->val = val;
return 0;
+error:
+ isl_map_free(key);
+ isl_basic_set_free(val);
+ return -1;
}
}