From: Wootak Jung Date: Wed, 22 Nov 2023 04:09:19 +0000 (+0900) Subject: Fix memory leak X-Git-Tag: accepted/tizen/8.0/unified/20231127.165021^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F02%2F301702%2F1;p=platform%2Fcore%2Fapi%2Fbluetooth.git Fix memory leak Change-Id: I957c7126ffbcbc614160826ffcb0e8cfa9b7383d Signed-off-by: Wootak Jung --- diff --git a/src/bluetooth-common.c b/src/bluetooth-common.c index 223dbbd..41841e1 100644 --- a/src/bluetooth-common.c +++ b/src/bluetooth-common.c @@ -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: diff --git a/src/bluetooth-gatt.c b/src/bluetooth-gatt.c index d207708..34daf28 100644 --- a/src/bluetooth-gatt.c +++ b/src/bluetooth-gatt.c @@ -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 */