Fix error handle bug 21/117421/3
authorjongmyeongko <jongmyeong.ko@samsung.com>
Mon, 6 Mar 2017 05:05:26 +0000 (14:05 +0900)
committerjongmyeongko <jongmyeong.ko@samsung.com>
Mon, 6 Mar 2017 06:14:04 +0000 (15:14 +0900)
When there was an error in previous iteration,
error->messge wil be referenced as an freed state in next iteration.
This may causes a crash.

Change-Id: Iedf6414ea359a1decc06007a919650469768c705
Signed-off-by: jongmyeongko <jongmyeong.ko@samsung.com>
plugin/app2sd/lib/app2sd_client_interface.c

index 52313d6..a104255 100644 (file)
@@ -85,6 +85,7 @@ static int __app2sd_call_server_method(const gchar *method_name,
                        _E("failed to create new proxy, error(%s)",
                                error->message);
                        g_error_free(error);
+                       error = NULL;
                        ret = APP2EXT_ERROR_DBUS_FAILED;
                        retry_cnt++;
                        usleep(CONNECTION_WAIT_USEC);
@@ -97,6 +98,7 @@ static int __app2sd_call_server_method(const gchar *method_name,
                if (error != NULL) {
                        _E("proxy call sync error(%s)", error->message);
                        g_error_free(error);
+                       error = NULL;
                        ret = APP2EXT_ERROR_DBUS_FAILED;
                        retry_cnt++;
                        usleep(CONNECTION_WAIT_USEC);