summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Schmidt <stefan@osg.samsung.com>2016-07-29 14:53:36 +0200
committerStefan Schmidt <stefan@osg.samsung.com>2016-07-29 14:53:36 +0200
commit3bd4c19f55ec23e816cb48599da5876982f421eb (patch)
treeb082667ff844a9d3ddfe15e147b6dc95e9214597
parent461c5d2787c06b0f07433616a995567831c2dc44 (diff)
eina: promise: fix memory leak in error path
If we would not get a promise back here the allocated array would leak when we return. Make sure we also free it in this case. CID: 1360468
-rw-r--r--src/lib/eina/eina_promise.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/lib/eina/eina_promise.c b/src/lib/eina/eina_promise.c
index 8ee5809f9a..31310c1bbe 100644
--- a/src/lib/eina/eina_promise.c
+++ b/src/lib/eina/eina_promise.c
@@ -601,7 +601,11 @@ eina_promise_all(Eina_Iterator* it)
601 eina_iterator_free(it); 601 eina_iterator_free(it);
602 602
603 promise = eina_safepointer_get((Eina_Safepointer*)(safe_promise = eina_promise_add())); 603 promise = eina_safepointer_get((Eina_Safepointer*)(safe_promise = eina_promise_add()));
604 if (!promise) return NULL; 604 if (!promise)
605 {
606 eina_array_free(promises);
607 return NULL;
608 }
605 609
606 internal_it = promise->pointer_value = malloc(sizeof(_Eina_Promise_Iterator) + 610 internal_it = promise->pointer_value = malloc(sizeof(_Eina_Promise_Iterator) +
607 sizeof(_Eina_Promise_Default_Owner*) * eina_array_count_get(promises)); 611 sizeof(_Eina_Promise_Default_Owner*) * eina_array_count_get(promises));