From 70d8d26d8ed27f25689bf75bdb3da320d418c38a Mon Sep 17 00:00:00 2001 From: duerpei Date: Tue, 15 Mar 2022 10:26:03 +0800 Subject: Fix potential memory leak in agl-compositor wet_main->parse_options-> .... ->strdup ->malloc "config_file" memory is not released "log"memory is not released When agl-compositor startup parameters contain socket and modules, the memory of socket_name and option_modules also needs to be released. So these two pointers are also released. Bug-AGL: SPEC-4270 Signed-off-by: duerpei Change-Id: I0d74b92187a0779610f32e75b33ab4fca10329a5 --- src/compositor.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/compositor.c b/src/compositor.c index fd5f5a6..d335c60 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -1645,13 +1645,14 @@ int wet_main(int argc, char *argv[]) if (version) { printf(PACKAGE_STRING "\n"); - return EXIT_SUCCESS; + ret = EXIT_SUCCESS; + goto exit_signals; } log_ctx = weston_log_ctx_compositor_create(); if (!log_ctx) { fprintf(stderr, "Failed to initialize weston debug framework.\n"); - return ret; + goto exit_signals; } log_scope = weston_compositor_add_log_scope(log_ctx, "log", @@ -1796,5 +1797,10 @@ error_signals: if (ivi.config) weston_config_destroy(ivi.config); +exit_signals: + free(log); + free(config_file); + free(socket_name); + free(option_modules); return ret; } -- cgit 1.2.3-korg