From patchwork Sat Jun 23 00:33:19 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 166712 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 0BADEB6F9F for ; Sat, 23 Jun 2012 11:25:55 +1000 (EST) Received: from localhost ([::1]:58960 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SiEK3-00007i-Dt for incoming@patchwork.ozlabs.org; Fri, 22 Jun 2012 20:35:31 -0400 Received: from eggs.gnu.org ([208.118.235.92]:53984) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SiEJ3-00070c-N4 for qemu-devel@nongnu.org; Fri, 22 Jun 2012 20:34:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SiEJ1-0007wz-OW for qemu-devel@nongnu.org; Fri, 22 Jun 2012 20:34:29 -0400 Received: from mail-pb0-f45.google.com ([209.85.160.45]:36193) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SiEJ1-0007st-G6 for qemu-devel@nongnu.org; Fri, 22 Jun 2012 20:34:27 -0400 Received: by mail-pb0-f45.google.com with SMTP id ro12so4321638pbb.4 for ; Fri, 22 Jun 2012 17:34:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=omD9A+co+KcrHlA2kh82fykHP7yHAOUnwHNnpFp1QEg=; b=nX7IVrjdnBSRjthGyDZLdpmSGDOP6uS3ip5k4flMXE0nMLCiHzPmmvKmCCk8xJJ92N 4cGPfe5RRx8jbEpiBreEJ695dkV3cxORNulvwRDn6dnvB485GZKWnwOaXhgq+J5tnN2U 0PAqDfOhm++oyb3mf5c9Pp83MlxkCOyjQVD3A3iMztLf+vhF8KLEcjT3RyirIR3WfcsT neGfg5aju9wCtKOlI9dh94Zy0diAtNqWEGaB7H0eLne9xPFv0IHQlZeJctRnBSbPa3g0 gTgzn/pldCn3qYnCGHlZWDjz7ZtHNsUfmI6YIdilewEbDcHzfIDtG2JM88Yznw4DxN5J NmkA== Received: by 10.68.203.7 with SMTP id km7mr15730378pbc.7.1340411666468; Fri, 22 Jun 2012 17:34:26 -0700 (PDT) Received: from localhost.localdomain ([32.97.110.59]) by mx.google.com with ESMTPS id os1sm630169pbb.49.2012.06.22.17.34.24 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 22 Jun 2012 17:34:25 -0700 (PDT) From: Michael Roth To: qemu-devel@nongnu.org Date: Fri, 22 Jun 2012 19:33:19 -0500 Message-Id: <1340411610-22596-16-git-send-email-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1340411610-22596-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1340411610-22596-1-git-send-email-mdroth@linux.vnet.ibm.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.160.45 Cc: aliguori@us.ibm.com Subject: [Qemu-devel] [PATCH stable-1.1 15/26] monitor: Fix memory leak with readline completion X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Stefan Weil Each string which is shown during readline completion in the QEMU monitor is allocated dynamically but currently never deallocated. Add the missing loop which calls g_free for the allocated strings. Signed-off-by: Stefan Weil Reviewed-by: Stefan Hajnoczi --- readline.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/readline.c b/readline.c index a6c0039..540cd8a 100644 --- a/readline.c +++ b/readline.c @@ -337,6 +337,9 @@ static void readline_completion(ReadLineState *rs) } readline_show_prompt(rs); } + for (i = 0; i < rs->nb_completions; i++) { + g_free(rs->completions[i]); + } } /* return true if command handled */