From 8e8c66fa39d5300a33615d601d98fb7ff9f1e118 Mon Sep 17 00:00:00 2001 From: hyunho Date: Fri, 11 Sep 2020 16:35:21 +0900 Subject: Fix memory leak Change-Id: I22e9b46c0e79252fdd57dad357b8d335efd68681 Signed-off-by: hyunho --- src/base/watch_base.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/base/watch_base.c b/src/base/watch_base.c index 73b4beb..8b8bb26 100755 --- a/src/base/watch_base.c +++ b/src/base/watch_base.c @@ -586,6 +586,8 @@ int __on_change_signal(const char *endpoint, aul_app_com_result_e e, _E("mode is nullptr"); return 0; } + if (__context.extra) + bundle_free(__context.extra); __context.extra = bundle_decode((bundle_raw *)extra, strlen(extra)); __handling_ambient_mode(atoi(mode), NULL); @@ -616,8 +618,10 @@ static void __unset_ambient_changed_cb() __context.conn = NULL; } - if (__context.extra) + if (__context.extra) { bundle_free(__context.extra); + __context.extra = NULL; + } } static int __on_ui_base_create(void *data) @@ -1066,6 +1070,8 @@ EXPORT_API int watch_base_init(int argc, char **argv, __context.ambient_mode_skip_resume = false; __context.data = user_data; __context.state = WATCH_BASE_STATE_CREATING; + if (__context.extra) + bundle_free(__context.extra); __context.extra = NULL; return appcore_ui_base_init(ops, argc, argv, NULL, 0); -- cgit v1.2.3