From patchwork Wed Jan 4 04:31:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Qiang X-Patchwork-Id: 9496095 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C97DB606B5 for ; Wed, 4 Jan 2017 04:39:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C12A42780C for ; Wed, 4 Jan 2017 04:39:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B563427C2D; Wed, 4 Jan 2017 04:39:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D74E72780C for ; Wed, 4 Jan 2017 04:39:47 +0000 (UTC) Received: from localhost ([::1]:37251 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cOdMZ-00031n-0o for patchwork-qemu-devel@patchwork.kernel.org; Tue, 03 Jan 2017 23:39:47 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34061) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cOdEp-0005EH-Oe for qemu-devel@nongnu.org; Tue, 03 Jan 2017 23:31:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cOdEl-0005Fv-Qi for qemu-devel@nongnu.org; Tue, 03 Jan 2017 23:31:47 -0500 Received: from mail-qt0-x243.google.com ([2607:f8b0:400d:c0d::243]:34648) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cOdEl-0005FK-NI for qemu-devel@nongnu.org; Tue, 03 Jan 2017 23:31:43 -0500 Received: by mail-qt0-x243.google.com with SMTP id j29so1640047qtc.1 for ; Tue, 03 Jan 2017 20:31:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:from:to:cc:subject:date; bh=beDjeV0IDpkA8swClJJo4sLEB2f2zYPoQCsaUzmAAeA=; b=tuKldH2z++h/d7lw7Vl2CbAqF4j5CLF49oj5yGUgiuFj5FtoSTvv9xWmWjfIuYvCd0 gMq2pe/6fQ7VortZAMtXdET/vBAvGY98WQzFDVC+3WcM8rhbWvqyXaM0Wf8wukKX89Xu Hd9/LIjifThjlAGLrWB62+ocsrZBwy29kQEyuYS9uMZvtITKS4r5Tjatp7jzdqI+KVsc +3I7pBgOJVtd203+8iIYGYMToBFmj/F5/pKTcpmTpo91OdVT+NJJr55eZ7UZT95V0g2j lUlSOuWBKHEQuO5AjZ90qkf10vqv+Kc6QNlFv8LBMsOzA/vpAZQM1v0g/W9qrRvHZAE5 D8yQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:from:to:cc:subject:date; bh=beDjeV0IDpkA8swClJJo4sLEB2f2zYPoQCsaUzmAAeA=; b=jVik26TGetvn1o4JfsJR144eIDLl3p7e5/mEIZMOlr+gSpSRrpuxFot0crsp6HL+go vXI/BAn2Sfvbyz6t513fD0mZq5/VXGlRvc4/Bk2qrYZ9XH/zq1HIgzngw1IsTOfoifQE jd+2QJwIgIVA+6VgC9yw9P5dtA+6XwqUKvLP4V1q7eLrSd8bKvSGVgyHPNWPxoycf3P4 4I5VXkSNCoEPWOlSTN50gmP/ev2DO8YDcULDfX7A8bRoZ3s4RpT9be5cHB59exQOwYU9 wiLc52r3IyBd8naI64irlLcx9BZqmziS5E0B/QVQhFl9Hk5Xgf0uJRGSVkZu0qYnedGu zZFg== X-Gm-Message-State: AIkVDXIQIkTXd+ALeveKRVCt3jpzMMWO7dIobVKZWeOF9k+qBgRSod6Bvag2vnHyJfZ04w== X-Received: by 10.200.53.71 with SMTP id z7mr50410469qtb.203.1483504301750; Tue, 03 Jan 2017 20:31:41 -0800 (PST) Received: from localhost.localdomain.localdomain ([104.192.110.250]) by smtp.gmail.com with ESMTPSA id u8sm29055360qtb.37.2017.01.03.20.31.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Jan 2017 20:31:41 -0800 (PST) Message-ID: <586c7aad.0834c80a.d7aff.122e@mx.google.com> X-Google-Original-Message-ID: <1483504294-21386-1-git-send-email-Qiang(liqiang6-s@360.cn)> From: Li Qiang X-Google-Original-From: Li Qiang(liqiang6-s@360.cn) To: berrange@redhat.com, qemu-devel@nongnu.org Date: Tue, 3 Jan 2017 20:31:34 -0800 X-Mailer: git-send-email 1.8.3.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400d:c0d::243 Subject: [Qemu-devel] [PATCH] Crypto: fix leak in ivgen essiv init X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: liqiang6-s@360.cn Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Li Qiang On error path, the 'salt' doesn't been freed thus leading a memory leak. This patch avoid this. Signed-off-by: Li Qiang --- crypto/ivgen-essiv.c | 1 + 1 file changed, 1 insertion(+) diff --git a/crypto/ivgen-essiv.c b/crypto/ivgen-essiv.c index 634de63..cba20bd 100644 --- a/crypto/ivgen-essiv.c +++ b/crypto/ivgen-essiv.c @@ -48,6 +48,7 @@ static int qcrypto_ivgen_essiv_init(QCryptoIVGen *ivgen, &salt, &nhash, errp) < 0) { g_free(essiv); + g_free(salt); return -1; }