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 21:16:39 +0200
commit0874c4da3823ceae0dfcda44b0e0d5e6251e39a9 (patch)
treeae6d47fb97e48d062d59613f48248b361ad29e7b
parent322adb2e035fec05de109568934a013afe0b9edb (diff)
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 81b6ba211c..8ed28947eb 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)
774 774
775 WRN("could not get data from child Efl.Model"); 775 WRN("could not get data from child Efl.Model");
776 776
777 ++(lreq->item_processed_count); 777 lreq->item_total--;
778 if (lreq->item_processed_count >= lreq->item_total)
779 {
780 if (!lreq->valid)
781 {
782 _listing_request_cleanup(lreq);
783 return;
784 }
785 _signal_first(lreq);
786 _process_last(lreq);
787 }
788} 778}
789 779
790static void 780static void