Fix memory leak 02/301702/1 accepted/tizen/8.0/unified/20231127.165021
authorWootak Jung <wootak.jung@samsung.com>
Wed, 22 Nov 2023 04:09:19 +0000 (13:09 +0900)
committerWootak Jung <wootak.jung@samsung.com>
Wed, 22 Nov 2023 04:10:37 +0000 (13:10 +0900)
Change-Id: I957c7126ffbcbc614160826ffcb0e8cfa9b7383d
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
src/bluetooth-common.c
src/bluetooth-gatt.c

index 223dbbd31afdcdff7c526bba39ee1834355d9346..41841e1e6f93fa64c9ade68cac883188477e98c1 100644 (file)
@@ -796,7 +796,7 @@ char *_bt_convert_uuid_to_uuid128(const char *uuid)
                break; /* LCOV_EXCL_LINE */
 
        case 36:        /* UUID 128bits */
-               uuid128 = strdup(uuid); /* LCOV_EXCL_LINE */
+               uuid128 = g_strdup(uuid); /* LCOV_EXCL_LINE */
                break; /* LCOV_EXCL_LINE */
 
        default:
index d207708ab9facf1ebc2107749f84c1dc196cbe7d..34daf284c9de5da294642fc7a48426a5f236f62f 100644 (file)
@@ -3844,9 +3844,11 @@ int bt_gatt_server_set_service_persistence(const char *uuid)
        if (error_code != BT_ERROR_NONE) { /* LCOV_EXCL_LINE */
                BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), /* LCOV_EXCL_LINE */
                                error_code); /* LCOV_EXCL_LINE */
+               g_free(uuid128);
                return error_code; /* LCOV_EXCL_LINE */
        }
 
+       g_free(uuid128);
        return BT_ERROR_NONE;
 }
 
@@ -3871,9 +3873,11 @@ int bt_gatt_server_unset_service_persistence(const char *uuid)
        if (error_code != BT_ERROR_NONE) { /* LCOV_EXCL_LINE */
                BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), /* LCOV_EXCL_LINE */
                                error_code); /* LCOV_EXCL_LINE */
+               g_free(uuid128);
                return error_code; /* LCOV_EXCL_LINE */
        }
 
+       g_free(uuid128);
        return BT_ERROR_NONE;
 }
 /* LCOV_EXCL_STOP */