pio: assign null to handle if open is failed 93/165593/1
authorkibak.yoon <kibak.yoon@samsung.com>
Tue, 2 Jan 2018 03:10:05 +0000 (12:10 +0900)
committerkibak.yoon <kibak.yoon@samsung.com>
Tue, 2 Jan 2018 03:10:05 +0000 (12:10 +0900)
 - To prevent "use after free", NULL should assign to the handle.

Change-Id: I974442074cb778d3f2e9797bc291b9098f3017f5
Signed-off-by: kibak.yoon <kibak.yoon@samsung.com>
src/gdbus/peripheral_gdbus_gpio.c

index 6c0fe498adf78a9e23878eff40a79c9c10a8ea8c..0f52b7bfee23e6dd4cc4b684d40c155f09278692 100644 (file)
@@ -75,6 +75,7 @@ gboolean peripheral_gdbus_gpio_open(
        if (ret != PERIPHERAL_ERROR_NONE) {
                _E("Failed to export gpio");
                peripheral_handle_gpio_destroy(gpio_handle);
+               gpio_handle = NULL;
                goto out;
        }
 
@@ -83,6 +84,7 @@ gboolean peripheral_gdbus_gpio_open(
                _E("Failed to create gpio fd list");
                peripheral_interface_gpio_unexport(pin);
                peripheral_handle_gpio_destroy(gpio_handle);
+               gpio_handle = NULL;
                goto out;
        }
 
@@ -124,4 +126,4 @@ gboolean peripheral_gdbus_gpio_close(
        peripheral_io_gdbus_gpio_complete_close(gpio, invocation, ret);
 
        return true;
-}
\ No newline at end of file
+}