summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean Guyomarc'h <jean.guyomarch@openwide.fr>2016-08-26 15:04:37 +0200
committerJean Guyomarc'h <jean@guyomarch.bzh>2016-08-26 19:45:46 +0200
commitde68c472c597736e168166a480224e27ce330f51 (patch)
tree2878ea0d7b359704fc3a8a13a88e1b2a52b06314
parent2d7c73884c6ca5838b2dbd552b9529a4d79fe36b (diff)
downloadefl-de68c472c597736e168166a480224e27ce330f51.tar.gz
elementary: prevent double free
This one is a bit tricky... When we create the aggregated promise, if one of the properties of the model returns an error, the eina_promise_then() will immediately call the error callback. In this happened for the first item, the total items in the listing request would be 1. Before this commit, we tested for incremented the processed counter and compared it to this total count. If it was greater or equal, we would free the common listing request. But in the case of successive failures, we would set the total counter to 1, then the processed counter to 1 and therefore free. Then increment the total counter to 2, then then processed counter to 2, and free again... which would cause an abort() from the libc or something else nasty. Now we just decrease the total count of items. We avoid the cases and double frees, without leaking.
-rw-r--r--src/lib/elementary/elc_fileselector.c12
1 files changed, 1 insertions, 11 deletions
diff --git a/src/lib/elementary/elc_fileselector.c b/src/lib/elementary/elc_fileselector.c
index 308542bdee..750833a834 100644
--- a/src/lib/elementary/elc_fileselector.c
+++ b/src/lib/elementary/elc_fileselector.c
@@ -774,17 +774,7 @@ _process_child_error_cb(void *data, Eina_Error err EINA_UNUSED)
WRN("could not get data from child Efl.Model");
- ++(lreq->item_processed_count);
- if (lreq->item_processed_count >= lreq->item_total)
- {
- if (!lreq->valid)
- {
- _listing_request_cleanup(lreq);
- return;
- }
- _signal_first(lreq);
- _process_last(lreq);
- }
+ lreq->item_total--;
}
static void