From a19de875989249241c0f11ea43c33d1488f94612 Mon Sep 17 00:00:00 2001 From: Wootak Jung Date: Wed, 22 Nov 2023 13:09:19 +0900 Subject: [PATCH] Fix memory leak Change-Id: I957c7126ffbcbc614160826ffcb0e8cfa9b7383d Signed-off-by: Wootak Jung --- src/bluetooth-common.c | 2 +- src/bluetooth-gatt.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) 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 */ -- 2.34.1