From: SeokHoon Lee Date: Mon, 5 Dec 2016 01:21:33 +0000 (+0900) Subject: Change some free to g-free because it was alloced by g_strdup/g_strdup_printf X-Git-Tag: submit/tizen_3.0/20161206.052949^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F58%2F102058%2F2;p=platform%2Fcore%2Fapi%2Fscreen-mirroring.git Change some free to g-free because it was alloced by g_strdup/g_strdup_printf [Version] 0.1.59 [Profile] Common [Issue Type] Code refactoring [Dependency module] N/A [Test] [M(T) - Boot=(OK), sdb=(OK), Home=(OK), Touch=(OK), Version=tizen-3.0-mobile_20161130.2] Signed-off-by: SeokHoon Lee Change-Id: I5c8f3695f998e83fcbf378a2191ab5bfcc0a27b4 --- diff --git a/include/scmirroring_private.h b/include/scmirroring_private.h old mode 100755 new mode 100644 index 387bf4a..ba76c2e --- a/include/scmirroring_private.h +++ b/include/scmirroring_private.h @@ -88,6 +88,7 @@ extern "C" { } while (0) #define SCMIRRORING_SAFE_FREE(src) { if (src) {free(src); src = NULL; } } +#define SCMIRRORING_SAFE_G_FREE(src) { if (src) {g_free(src); src = NULL; } } #define STRING_VALID(str) ((str != NULL && strlen(str) > 0) ? TRUE : FALSE) #define SCMIRRORING_STATE_CMD_START "START" diff --git a/miracast_server/miracast_server_impl.c b/miracast_server/miracast_server_impl.c index 4dce052..31b5c9c 100644 --- a/miracast_server/miracast_server_impl.c +++ b/miracast_server/miracast_server_impl.c @@ -477,7 +477,7 @@ gint miracast_server_gst_init() /* release */ for (i = 0; i < *argc; i++) - SCMIRRORING_SAFE_FREE(argv[i]); + SCMIRRORING_SAFE_G_FREE(argv[i]); SCMIRRORING_SAFE_FREE(argv); SCMIRRORING_SAFE_FREE(argc); @@ -486,7 +486,7 @@ gint miracast_server_gst_init() ERROR: for (i = 0; i < *argc; i++) - SCMIRRORING_SAFE_FREE(argv[i]); + SCMIRRORING_SAFE_G_FREE(argv[i]); SCMIRRORING_SAFE_FREE(argv); SCMIRRORING_SAFE_FREE(argc); diff --git a/packaging/capi-media-screen-mirroring.spec b/packaging/capi-media-screen-mirroring.spec index 59b5dd5..bedea9e 100644 --- a/packaging/capi-media-screen-mirroring.spec +++ b/packaging/capi-media-screen-mirroring.spec @@ -1,6 +1,6 @@ Name: capi-media-screen-mirroring Summary: A screen mirroring library in Tizen C API -Version: 0.1.58 +Version: 0.1.59 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/scmirroring_src.c b/src/scmirroring_src.c index c28dad0..887cb50 100644 --- a/src/scmirroring_src.c +++ b/src/scmirroring_src.c @@ -53,7 +53,7 @@ static gboolean __scmirroring_src_callback_call(gpointer data) g_io_channel_shutdown(scmirroring->channel, FALSE, NULL); g_io_channel_unref(scmirroring->channel); - SCMIRRORING_SAFE_FREE(scmirroring->sock_path); + SCMIRRORING_SAFE_G_FREE(scmirroring->sock_path); SCMIRRORING_SAFE_FREE(scmirroring); } @@ -80,7 +80,7 @@ static int __scmirroring_src_send_cmd_to_server(scmirroring_src_s *scmirroring, scmirroring_debug("Sent message [%s] successfully", _cmd); } - SCMIRRORING_SAFE_FREE(_cmd); + SCMIRRORING_SAFE_G_FREE(_cmd); return ret; } @@ -294,12 +294,12 @@ static int __scmirroring_src_send_set_cm(scmirroring_src_h scmirroring) cmd = g_strdup_printf("SET CM %d", _scmirroring->connect_mode); ret = __scmirroring_src_send_cmd_to_server(_scmirroring, cmd); if (ret != SCMIRRORING_ERROR_NONE) { - SCMIRRORING_SAFE_FREE(cmd); + SCMIRRORING_SAFE_G_FREE(cmd); scmirroring_error("Failed to be ready [%d]", ret); return SCMIRRORING_ERROR_INVALID_OPERATION; } - SCMIRRORING_SAFE_FREE(cmd); + SCMIRRORING_SAFE_G_FREE(cmd); return ret; } @@ -314,12 +314,12 @@ static int __scmirroring_src_send_set_ip(scmirroring_src_h scmirroring) cmd = g_strdup_printf("SET IP %s:%s", _scmirroring->ip, _scmirroring->port); ret = __scmirroring_src_send_cmd_to_server(_scmirroring, cmd); if (ret != SCMIRRORING_ERROR_NONE) { - SCMIRRORING_SAFE_FREE(cmd); + SCMIRRORING_SAFE_G_FREE(cmd); scmirroring_error("Failed to be ready [%d]", ret); return SCMIRRORING_ERROR_INVALID_OPERATION; } - SCMIRRORING_SAFE_FREE(cmd); + SCMIRRORING_SAFE_G_FREE(cmd); return ret; } @@ -334,12 +334,12 @@ static int __scmirroring_src_send_set_reso(scmirroring_src_h scmirroring) cmd = g_strdup_printf("SET RESO %d", _scmirroring->resolution); ret = __scmirroring_src_send_cmd_to_server(_scmirroring, cmd); if (ret != SCMIRRORING_ERROR_NONE) { - SCMIRRORING_SAFE_FREE(cmd); + SCMIRRORING_SAFE_G_FREE(cmd); scmirroring_error("Failed to be ready [%d]", ret); return SCMIRRORING_ERROR_INVALID_OPERATION; } - SCMIRRORING_SAFE_FREE(cmd); + SCMIRRORING_SAFE_G_FREE(cmd); return ret; } @@ -354,12 +354,12 @@ static int __scmirroring_src_send_set_multisink(scmirroring_src_h scmirroring) cmd = g_strdup_printf("SET MULTISINK %d", _scmirroring->resolution); ret = __scmirroring_src_send_cmd_to_server(_scmirroring, cmd); if (ret != SCMIRRORING_ERROR_NONE) { - SCMIRRORING_SAFE_FREE(cmd); + SCMIRRORING_SAFE_G_FREE(cmd); scmirroring_error("Failed to be ready [%d]", ret); return SCMIRRORING_ERROR_INVALID_OPERATION; } - SCMIRRORING_SAFE_FREE(cmd); + SCMIRRORING_SAFE_G_FREE(cmd); return ret; } @@ -370,17 +370,17 @@ static int __scmirroring_src_send_switch_transport(scmirroring_src_h scmirroring char *cmd = NULL; int ret = SCMIRRORING_ERROR_NONE; scmirroring_src_s *_scmirroring = (scmirroring_src_s *)scmirroring; - const char *tr = _scmirroring->av_transport == SCMIRRORING_AV_TRANSPORT_UDP ? "UDP": "TCP"; + const char *tr = _scmirroring->av_transport == SCMIRRORING_AV_TRANSPORT_UDP ? "UDP" : "TCP"; cmd = g_strdup_printf("SWITCH %s", tr); ret = __scmirroring_src_send_cmd_to_server(_scmirroring, cmd); if (ret != SCMIRRORING_ERROR_NONE) { - SCMIRRORING_SAFE_FREE(cmd); + SCMIRRORING_SAFE_G_FREE(cmd); scmirroring_error("Failed to be ready [%d]", ret); return SCMIRRORING_ERROR_INVALID_OPERATION; } - SCMIRRORING_SAFE_FREE(cmd); + SCMIRRORING_SAFE_G_FREE(cmd); return ret; } @@ -734,7 +734,7 @@ int scmirroring_src_disconnect(scmirroring_src_h scmirroring) _scmirroring->sock = -1; } - SCMIRRORING_SAFE_FREE(_scmirroring->sock_path); + SCMIRRORING_SAFE_G_FREE(_scmirroring->sock_path); _scmirroring->connected = NOT_CONNECTED_TO_SERVER; scmirroring_debug_fleave(); @@ -803,7 +803,7 @@ int scmirroring_src_resume(scmirroring_src_h scmirroring) } int scmirroring_src_AV_transport_switch(scmirroring_src_h scmirroring, - scmirroring_av_transport_e transport) + scmirroring_av_transport_e transport) { CHECK_FEATURE_SUPPORTED(WIFIDIRECT_DISPLAY_FEATURE); @@ -815,7 +815,7 @@ int scmirroring_src_AV_transport_switch(scmirroring_src_h scmirroring, scmirroring_retvm_if(_scmirroring == NULL, SCMIRRORING_ERROR_INVALID_PARAMETER, "Handle is NULL"); if (transport < SCMIRRORING_AV_TRANSPORT_UDP || transport > SCMIRRORING_AV_TRANSPORT_TCP) { - scmirroring_error ("Invalid transport"); + scmirroring_error("Invalid transport"); return SCMIRRORING_ERROR_INVALID_PARAMETER; }