From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O7WXm-0002G8-QY for qemu-devel@nongnu.org; Thu, 29 Apr 2010 12:24:54 -0400 Received: from [140.186.70.92] (port=60100 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O7WXh-0002Bv-Hc for qemu-devel@nongnu.org; Thu, 29 Apr 2010 12:24:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O7WXg-0003cw-4W for qemu-devel@nongnu.org; Thu, 29 Apr 2010 12:24:49 -0400 Received: from thoth.sbs.de ([192.35.17.2]:24640) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O7WXf-0003cd-Rg for qemu-devel@nongnu.org; Thu, 29 Apr 2010 12:24:48 -0400 Message-ID: <4BD9B2CB.7060107@siemens.com> Date: Thu, 29 Apr 2010 18:24:43 +0200 From: Jan Kiszka MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [PATCH] Fix tiny leak in qemu_opts_parse List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel Cc: Gerd Hoffmann qemu_opts_create duplicates the id we pass in case it shall be stored in the opts. So we do not need to dup it in qemu_opts_parse, leaking a few bytes this way. Signed-off-by: Jan Kiszka --- qemu-option.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/qemu-option.c b/qemu-option.c index 1ffc497..076dddf 100644 --- a/qemu-option.c +++ b/qemu-option.c @@ -763,10 +763,10 @@ QemuOpts *qemu_opts_parse(QemuOptsList *list, const char *params, if (strncmp(params, "id=", 3) == 0) { get_opt_value(value, sizeof(value), params+3); - id = qemu_strdup(value); + id = value; } else if ((p = strstr(params, ",id=")) != NULL) { get_opt_value(value, sizeof(value), p+4); - id = qemu_strdup(value); + id = value; } opts = qemu_opts_create(list, id, 1); if (opts == NULL)