Prevent duplicate creation and deletion of tethering handles 19/305919/2
authorSeonah Moon <seonah1.moon@samsung.com>
Tue, 13 Feb 2024 11:27:40 +0000 (20:27 +0900)
committerSeonah Moon <seonah1.moon@samsung.com>
Tue, 13 Feb 2024 11:43:13 +0000 (20:43 +0900)
Change-Id: I1873671497ec2cc74691fa809716c46265b81b0f

src/tethering.c

index 55fc98acde49852c5fae3db58b7599a7b2dfba29..019cc02142aa2221479289a702ab2e1e9f74ff50 100755 (executable)
@@ -1597,6 +1597,9 @@ API int tethering_create(tethering_h *tethering)
        CHECK_FEATURE_SUPPORTED(TETHERING_FEATURE);
        _retvm_if(tethering == NULL, TETHERING_ERROR_INVALID_PARAMETER,
                        "parameter(tethering) is NULL\n");
+       _retvm_if(_tethering_check_handle(*tethering) == true,
+                       TETHERING_ERROR_INVALID_PARAMETER,
+                       "Tethering handle is already enabled");
        INFO("+\n");
 
        __tethering_h *th = NULL;
@@ -1692,6 +1695,9 @@ API int tethering_destroy(tethering_h tethering)
        CHECK_FEATURE_SUPPORTED(TETHERING_FEATURE);
        _retvm_if(tethering == NULL, TETHERING_ERROR_INVALID_PARAMETER,
                        "parameter(tethering) is NULL\n");
+       _retvm_if(_tethering_check_handle(tethering) == false,
+                       TETHERING_ERROR_INVALID_PARAMETER,
+                       "Tethering Handle is not initialized");
 
        __tethering_h *th = (__tethering_h *)tethering;