interface: Disconnect an only existing connected interface 61/297761/1
authorSeung-Woo Kim <sw0312.kim@samsung.com>
Thu, 24 Aug 2023 02:23:00 +0000 (11:23 +0900)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Thu, 24 Aug 2023 02:29:49 +0000 (11:29 +0900)
Disconnect an only existing connected interface.
The interface can be already disconnected and it causes double
free during tfm_interface_exit().

Change-Id: I5cc23daf9d4fbf7cb909f9c07a5eaea59e99a476
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
src/interface.c

index 581a8e1..2c8cd2e 100644 (file)
@@ -289,7 +289,8 @@ void tfm_interface_exit(struct tfm_interface_context *ictx)
        if (!ictx)
                return;
 
-       tfm_interface_disconnect(ictx->connected);
+       if (ictx->connected)
+               tfm_interface_disconnect(ictx->connected);
        destroy_interface_list(ictx);
        free(ictx);
 }