pwm: fix potential segfault 90/260690/3
authorYoungjae Cho <y0.cho@samsung.com>
Thu, 1 Jul 2021 06:48:33 +0000 (15:48 +0900)
committerYoungjae Cho <y0.cho@samsung.com>
Thu, 1 Jul 2021 07:07:44 +0000 (16:07 +0900)
Change-Id: I304ccf87409fea57abcde3329693416891a92ed8
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
src/peripheral_pwm.c

index cedab7a115a1c746a6f780730db0598d97c71201..fe0bafd3b76be52417a815a190c460b7b3aa337d 100644 (file)
@@ -198,8 +198,7 @@ int peripheral_pwm_open(int chip, int pin, peripheral_pwm_h *pwm)
        ret = peripheral_pwm_export(chip, pin);
        if (ret != PERIPHERAL_ERROR_NONE) {
                _E("Failed to open PWM chip : %d, pin : %d", chip, pin);
-               free(handle);
-               handle = NULL;
+               return ret;
        }
 
        handle->chip = chip;