From: Jin Yoon Date: Tue, 4 Jul 2017 09:02:21 +0000 (+0900) Subject: Free resources on error conditions X-Git-Tag: submit/trunk/20170818.095510~30 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1cb28424e5d5473042a81a425f9eef1a49ad3278;p=apps%2Fnative%2Fposition-finder-server.git Free resources on error conditions Change-Id: Ibe75f5f522ef8bb5da6df18aa3d9af162d57e13a --- diff --git a/src/model/model_infrared_motion_sensor.c b/src/model/model_infrared_motion_sensor.c index 52d9b83..2215572 100644 --- a/src/model/model_infrared_motion_sensor.c +++ b/src/model/model_infrared_motion_sensor.c @@ -56,8 +56,8 @@ int model_init_infrared_motion_sensor(int gpio_num, void **peripheral_info) *peripheral_info = info; ret = peripheral_gpio_open(gpio_num, &info->gpio); - retv_if(ret != 0, -1); - retv_if(!info->gpio, -1); + goto_if(ret != 0, error); + goto_if(!info->gpio, error); ret = peripheral_gpio_set_direction(info->gpio, PERIPHERAL_GPIO_DIRECTION_IN); goto_if(ret != 0, error); diff --git a/src/model/model_infrared_obstacle_avoidance_sensor.c b/src/model/model_infrared_obstacle_avoidance_sensor.c index 9bed0eb..e63828a 100644 --- a/src/model/model_infrared_obstacle_avoidance_sensor.c +++ b/src/model/model_infrared_obstacle_avoidance_sensor.c @@ -55,8 +55,8 @@ int model_init_infrared_obstacle_avoidance_sensor(int gpio_num, void **periphera *peripheral_info = info; ret = peripheral_gpio_open(gpio_num, &info->gpio); - retv_if(ret != 0, -1); - retv_if(!info->gpio, -1); + goto_if(ret != 0, error); + goto_if(!info->gpio, error); ret = peripheral_gpio_set_direction(info->gpio, PERIPHERAL_GPIO_DIRECTION_IN); goto_if(ret != 0, error); diff --git a/src/model/model_touch_sensor.c b/src/model/model_touch_sensor.c index 749c583..f9a9580 100644 --- a/src/model/model_touch_sensor.c +++ b/src/model/model_touch_sensor.c @@ -54,8 +54,8 @@ int model_init_touch_sensor(int gpio_num, void **peripheral_info) *peripheral_info = info; ret = peripheral_gpio_open(gpio_num, &info->gpio); - retv_if(ret != 0, -1); - retv_if(!info->gpio, -1); + goto_if(ret != 0, error); + goto_if(!info->gpio, error); ret = peripheral_gpio_set_direction(info->gpio, PERIPHERAL_GPIO_DIRECTION_IN); goto_if(ret != 0, error);