From: Jeon Sang-Heon Date: Tue, 7 Jul 2020 11:45:31 +0000 (+0000) Subject: Fix segmentation fault X-Git-Tag: submit/tizen/20200710.163409~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e24dbc7406ea563f689657daba063e95991399d1;p=platform%2Fcore%2Fsystem%2Fupdate-control.git Fix segmentation fault - Fix wrong pointer casting - From API reference, get property value must be release using free Change-Id: Ibf8643e497a2a89bc47bd81b598e879f99169bc9 Signed-off-by: Jeon Sang-Heon --- diff --git a/src/update_control.c b/src/update_control.c index 0b67ac6..e406ff2 100644 --- a/src/update_control.c +++ b/src/update_control.c @@ -259,8 +259,14 @@ API int update_control_get_property(update_control_property_e property, void **v _E("Failed to get result : %d", status); return UPDATE_CONTROL_ERROR_INVALID_OPERATION; } - _I("Success to get result : %d", status); + + *value = malloc(sizeof(int)); + if (!*value) { + _E("Failed to allocate memory"); + return UPDATE_CONTROL_ERROR_OUT_OF_MEMORY; + } + *(int *)(*value) = status; return UPDATE_CONTROL_ERROR_NONE; default: