eldbus: Fix resource leak
authorChristopher Michael <cp.michael@samsung.com>
Tue, 19 Mar 2019 12:57:59 +0000 (08:57 -0400)
committerYeongjong Lee <yj34.lee@samsung.com>
Tue, 2 Apr 2019 03:45:17 +0000 (12:45 +0900)
Summary:
Coverity reports that we leak 'data' here (which can happen if we
error on 'eina_value_dup(value)'). Iniitalize 'data' to NULL, and add a
'free' call to cleanup 'data' before we return a rejected future.

Fixes Coverity CID1399097

@fix

Depends on D8350

Reviewers: raster, cedric, zmike, bu5hm4n, stefan_schmidt

Reviewed By: cedric

Subscribers: #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D8352

src/lib/eldbus/eldbus_model_proxy.c

index 00d85b4..bf1f8fb 100644 (file)
@@ -271,7 +271,7 @@ _eldbus_model_proxy_efl_model_property_set(Eo *obj EINA_UNUSED,
                                            const char *property,
                                            Eina_Value *value)
 {
-   Eldbus_Model_Proxy_Property_Set_Data *data;
+   Eldbus_Model_Proxy_Property_Set_Data *data = NULL;
    const char *signature;
    Eldbus_Pending *pending;
    unsigned char access;
@@ -314,6 +314,7 @@ _eldbus_model_proxy_efl_model_property_set(Eo *obj EINA_UNUSED,
                           .data = data, .free = _eldbus_model_proxy_cancel_cb);
 
  on_error:
+   free(data);
    return efl_loop_future_rejected(obj, err);
 }