All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Marc-André Lureau" <marcandre.lureau@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>
Subject: [Qemu-devel] [PATCH 10/12] qemu-config: fix leak in query-command-line-options
Date: Fri,  8 Dec 2017 01:58:23 +0100	[thread overview]
Message-ID: <20171208005825.14587-11-marcandre.lureau@redhat.com> (raw)
In-Reply-To: <20171208005825.14587-1-marcandre.lureau@redhat.com>

Direct leak of 160 byte(s) in 4 object(s) allocated from:
    #0 0x55ed7678cda8 in calloc (/home/elmarco/src/qq/build/x86_64-softmmu/qemu-system-x86_64+0x797da8)
    #1 0x7f3f5e725f75 in g_malloc0 /home/elmarco/src/gnome/glib/builddir/../glib/gmem.c:124
    #2 0x55ed778aa3a7 in query_option_descs /home/elmarco/src/qq/util/qemu-config.c:60:16
    #3 0x55ed778aa307 in get_drive_infolist /home/elmarco/src/qq/util/qemu-config.c:140:19
    #4 0x55ed778a9f40 in qmp_query_command_line_options /home/elmarco/src/qq/util/qemu-config.c:254:36
    #5 0x55ed76d4868c in qmp_marshal_query_command_line_options /home/elmarco/src/qq/build/qmp-marshal.c:3078:14
    #6 0x55ed77855dd5 in do_qmp_dispatch /home/elmarco/src/qq/qapi/qmp-dispatch.c:104:5
    #7 0x55ed778558cc in qmp_dispatch /home/elmarco/src/qq/qapi/qmp-dispatch.c:131:11
    #8 0x55ed768b592f in handle_qmp_command /home/elmarco/src/qq/monitor.c:3840:11
    #9 0x55ed7786ccfe in json_message_process_token /home/elmarco/src/qq/qobject/json-streamer.c:105:5
    #10 0x55ed778fe37c in json_lexer_feed_char /home/elmarco/src/qq/qobject/json-lexer.c:323:13
    #11 0x55ed778fdde6 in json_lexer_feed /home/elmarco/src/qq/qobject/json-lexer.c:373:15
    #12 0x55ed7786cd83 in json_message_parser_feed /home/elmarco/src/qq/qobject/json-streamer.c:124:12
    #13 0x55ed768b559e in monitor_qmp_read /home/elmarco/src/qq/monitor.c:3882:5
    #14 0x55ed77714f29 in qemu_chr_be_write_impl /home/elmarco/src/qq/chardev/char.c:167:9
    #15 0x55ed77714fde in qemu_chr_be_write /home/elmarco/src/qq/chardev/char.c:179:9
    #16 0x55ed7772ffad in tcp_chr_read /home/elmarco/src/qq/chardev/char-socket.c:440:13
    #17 0x55ed7777113b in qio_channel_fd_source_dispatch /home/elmarco/src/qq/io/channel-watch.c:84:12
    #18 0x7f3f5e71d90b in g_main_dispatch /home/elmarco/src/gnome/glib/builddir/../glib/gmain.c:3182
    #19 0x7f3f5e71e7ac in g_main_context_dispatch /home/elmarco/src/gnome/glib/builddir/../glib/gmain.c:3847
    #20 0x55ed77886ffc in glib_pollfds_poll /home/elmarco/src/qq/util/main-loop.c:214:9
    #21 0x55ed778865fd in os_host_main_loop_wait /home/elmarco/src/qq/util/main-loop.c:261:5
    #22 0x55ed77886222 in main_loop_wait /home/elmarco/src/qq/util/main-loop.c:515:11
    #23 0x55ed76d2a4df in main_loop /home/elmarco/src/qq/vl.c:1995:9
    #24 0x55ed76d1cb4a in main /home/elmarco/src/qq/vl.c:4914:5
    #25 0x7f3f555f6039 in __libc_start_main (/lib64/libc.so.6+0x21039)

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 util/qemu-config.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/util/qemu-config.c b/util/qemu-config.c
index 99b0e46fa3..029fec53a9 100644
--- a/util/qemu-config.c
+++ b/util/qemu-config.c
@@ -105,7 +105,8 @@ static void cleanup_infolist(CommandLineParameterInfoList *head)
             if (!strcmp(pre_entry->value->name, cur->next->value->name)) {
                 del_entry = cur->next;
                 cur->next = cur->next->next;
-                g_free(del_entry);
+                del_entry->next = NULL;
+                qapi_free_CommandLineParameterInfoList(del_entry);
                 break;
             }
             pre_entry = pre_entry->next;
-- 
2.15.1.355.g36791d7216

  parent reply	other threads:[~2017-12-08  0:59 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-08  0:58 [Qemu-devel] [PATCH 00/12] Various build-sys and ASAN related fixes Marc-André Lureau
2017-12-08  0:58 ` [Qemu-devel] [PATCH 01/12] build-sys: fix qemu-ga -pthread linking Marc-André Lureau
2017-12-08  0:58 ` [Qemu-devel] [PATCH 02/12] build-sys: silence make by default Marc-André Lureau
2017-12-08 19:19   ` Eric Blake
2017-12-13 11:30     ` Marc-André Lureau
2017-12-08  0:58 ` [Qemu-devel] [PATCH 03/12] build-sys: add a rule to print a variable Marc-André Lureau
2017-12-08 19:21   ` Eric Blake
2017-12-08  0:58 ` [Qemu-devel] [PATCH 04/12] build-sys: add AddressSanitizer when --enable-debug if possible Marc-André Lureau
2017-12-08  0:58 ` [Qemu-devel] [PATCH 05/12] tests: fix check-qobject leak: Marc-André Lureau
2017-12-08 17:59   ` Markus Armbruster
2017-12-08  0:58 ` [Qemu-devel] [PATCH 06/12] vl: fix direct firmware directories leak Marc-André Lureau
2017-12-08  0:58 ` [Qemu-devel] [PATCH 07/12] readline: add a free function Marc-André Lureau
2017-12-08 10:05   ` Dr. David Alan Gilbert
2017-12-08  0:58 ` [Qemu-devel] [PATCH 08/12] tests: fix migration-test leak Marc-André Lureau
2017-12-08  9:57   ` Dr. David Alan Gilbert
2017-12-08  0:58 ` [Qemu-devel] [PATCH 09/12] crypto: fix stack-buffer-overflow error Marc-André Lureau
2017-12-08  9:49   ` Daniel P. Berrange
2017-12-08  0:58 ` Marc-André Lureau [this message]
2017-12-08  0:58 ` [Qemu-devel] [PATCH 11/12] tests: fix qmp-test leak Marc-André Lureau
2017-12-08 18:01   ` Markus Armbruster
2017-12-08  0:58 ` [Qemu-devel] [PATCH 12/12] WIP ucontext: annotate coroutine stack for ASAN Marc-André Lureau
2017-12-08 13:38   ` Stefan Hajnoczi
2017-12-11 11:18     ` Marc-André Lureau
2017-12-11 11:31 ` [Qemu-devel] [PATCH 00/12] Various build-sys and ASAN related fixes no-reply
2017-12-11 11:34 ` no-reply
2017-12-11 12:25 ` no-reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171208005825.14587-11-marcandre.lureau@redhat.com \
    --to=marcandre.lureau@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.