From patchwork Fri Jul 12 21:28:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vitaly Chikunov X-Patchwork-Id: 11042697 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0044D138B for ; Fri, 12 Jul 2019 21:28:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E541026AE3 for ; Fri, 12 Jul 2019 21:28:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D9CF727FA8; Fri, 12 Jul 2019 21:28:47 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9343426AE3 for ; Fri, 12 Jul 2019 21:28:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728043AbfGLV2r (ORCPT ); Fri, 12 Jul 2019 17:28:47 -0400 Received: from vmicros1.altlinux.org ([194.107.17.57]:32826 "EHLO vmicros1.altlinux.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727994AbfGLV2r (ORCPT ); Fri, 12 Jul 2019 17:28:47 -0400 Received: from imap.altlinux.org (imap.altlinux.org [194.107.17.38]) by vmicros1.altlinux.org (Postfix) with ESMTP id 4D03672CCD9; Sat, 13 Jul 2019 00:28:45 +0300 (MSK) Received: from beacon.altlinux.org (unknown [185.6.174.98]) by imap.altlinux.org (Postfix) with ESMTPSA id B7A334A4AE8; Sat, 13 Jul 2019 00:28:44 +0300 (MSK) From: Vitaly Chikunov To: Mimi Zohar , Dmitry Kasatkin , linux-integrity@vger.kernel.org Subject: [PATCH v1 3/5] ima-evm-utils: Fix memory leak in get_password Date: Sat, 13 Jul 2019 00:28:31 +0300 Message-Id: <20190712212833.29280-3-vt@altlinux.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190712212833.29280-1-vt@altlinux.org> References: <20190712212833.29280-1-vt@altlinux.org> MIME-Version: 1.0 Sender: linux-integrity-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-integrity@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Free password buffer when return NULL. Partially fix CID 229894. --- src/evmctl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/evmctl.c b/src/evmctl.c index e07cff4..c556d05 100644 --- a/src/evmctl.c +++ b/src/evmctl.c @@ -1827,6 +1827,7 @@ static char *get_password(void) if (tcsetattr(fileno(stdin), TCSANOW, &tmp_flags) != 0) { perror("tcsetattr"); + free(password); return NULL; } @@ -1836,6 +1837,7 @@ static char *get_password(void) /* restore terminal */ if (tcsetattr(fileno(stdin), TCSANOW, &flags) != 0) { perror("tcsetattr"); + free(password); return NULL; }