pio: free the memory allocated by system_info_get_platform_string() 96/165596/2
authorkibak.yoon <kibak.yoon@samsung.com>
Tue, 2 Jan 2018 09:17:53 +0000 (18:17 +0900)
committerkibak.yoon <kibak.yoon@samsung.com>
Tue, 2 Jan 2018 10:51:01 +0000 (19:51 +0900)
Change-Id: Ibccb1798db42ac207ecb5f9d95858919b40371c6
Signed-off-by: kibak.yoon <kibak.yoon@samsung.com>
test/peripheral-io-test.c

index d8a103b..23b118d 100644 (file)
@@ -16,6 +16,7 @@
  */
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <system_info.h>
 
 #include "peripheral_io.h"
@@ -81,39 +82,41 @@ static int __test_peripheral_init()
 
        ret = __get_feature(KEY_FEATURE_PERIPHERAL_IO_GPIO, &feature);
        if (ret != PERIPHERAL_ERROR_NONE)
-               return ret;
+               goto ERR;
        ret = test_peripheral_io_gpio_initialize(model_name, feature);
        if (ret != PERIPHERAL_ERROR_NONE)
-               return ret;
+               goto ERR;
 
        ret = __get_feature(KEY_FEATURE_PERIPHERAL_IO_I2C, &feature);
        if (ret != PERIPHERAL_ERROR_NONE)
-               return ret;
+               goto ERR;
        ret = test_peripheral_io_i2c_initialize(model_name, feature);
        if (ret != PERIPHERAL_ERROR_NONE)
-               return ret;
+               goto ERR;
 
        ret = __get_feature(KEY_FEATURE_PERIPHERAL_IO_PWM, &feature);
        if (ret != PERIPHERAL_ERROR_NONE)
-               return ret;
+               goto ERR;
        ret = test_peripheral_io_pwm_initialize(model_name, feature);
        if (ret != PERIPHERAL_ERROR_NONE)
-               return ret;
+               goto ERR;
 
        ret = __get_feature(KEY_FEATURE_PERIPHERAL_IO_UART, &feature);
        if (ret != PERIPHERAL_ERROR_NONE)
-               return ret;
+               goto ERR;
        ret = test_peripheral_io_uart_initialize(model_name, feature);
        if (ret != PERIPHERAL_ERROR_NONE)
-               return ret;
+               goto ERR;
 
        ret = __get_feature(KEY_FEATURE_PERIPHERAL_IO_SPI, &feature);
        if (ret != PERIPHERAL_ERROR_NONE)
-               return ret;
+               goto ERR;
        ret = test_peripheral_io_spi_initialize(model_name, feature);
        if (ret != PERIPHERAL_ERROR_NONE)
-               return ret;
+               goto ERR;
 
+ERR:
+       free(model_name);
        return ret;
 }
 
@@ -536,4 +539,4 @@ int main(int argc, char **argv)
        }
 
        return -1;
-}
\ No newline at end of file
+}