From patchwork Thu Dec 7 22:12:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steffan Karger X-Patchwork-Id: 138 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director3.mail.ord1d.rsapps.net ([172.28.255.1]) by backend31.mail.ord1d.rsapps.net (Dovecot) with LMTP id G3JhMsNXKlqMVgAAgoeIoA for ; Fri, 08 Dec 2017 04:13:39 -0500 Received: from director3.mail.ord1c.rsapps.net ([172.28.255.1]) by director3.mail.ord1d.rsapps.net (Dovecot) with LMTP id c5s1MsNXKlqmKgAAkXNnRw ; Fri, 08 Dec 2017 04:13:39 -0500 Received: from smtp19.gate.ord1c ([172.28.255.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by director3.mail.ord1c.rsapps.net (Dovecot) with LMTP id BeavFMNXKlpTKgAAdSFV8w ; Fri, 08 Dec 2017 04:13:39 -0500 X-Spam-Threshold: 95 X-Spam-Score: 0 X-Spam-Flag: NO X-Virus-Scanned: OK X-Orig-To: openvpnslackdevel@openvpn.net X-Originating-Ip: [216.34.181.88] Authentication-Results: smtp19.gate.ord1c.rsapps.net; iprev=pass policy.iprev="216.34.181.88"; spf=pass smtp.mailfrom="openvpn-devel-bounces@lists.sourceforge.net" smtp.helo="lists.sourceforge.net"; dkim=fail (signature verification failed) header.d=sourceforge.net; dkim=fail (signature verification failed) header.d=sf.net; dkim=fail (signature verification failed) header.d=karger-me.20150623.gappssmtp.com; dmarc=none (p=nil; dis=none) header.from=karger.me X-Classification-ID: 1415288c-dbf8-11e7-bb5c-bc305bf036e4-1-1 Received: from [216.34.181.88] ([216.34.181.88:19346] helo=lists.sourceforge.net) by smtp19.gate.ord1c.rsapps.net (envelope-from ) (ecelerity 4.2.1.56364 r(Core:4.2.1.14)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id D7/58-15274-3C75A2A5; Fri, 08 Dec 2017 04:13:39 -0500 Received: from localhost ([127.0.0.1] helo=sfs-ml-2.v29.ch3.sourceforge.com) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.89) (envelope-from ) id 1eNEhu-0001Ug-1V; Fri, 08 Dec 2017 09:12:34 +0000 Received: from sfi-mx-3.v28.ch3.sourceforge.com ([172.29.28.193] helo=mx.sourceforge.net) by sfs-ml-2.v29.ch3.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) (envelope-from ) id 1eNEhs-0001UZ-Ix for openvpn-devel@lists.sourceforge.net; Fri, 08 Dec 2017 09:12:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=XsWRWDKv5SQtcHwa83Q9ThPJka5JNIx6EFWVy7tOeHA=; b=OXIWQR8V1t0oKNCwHZuDF+R/yN 8oXGbR53VjxblVm4W7Fleb8wTOYP6ByLFdqoxUAv0XsywgRy5l4tPb60b1FlQNkEX/84X2U48tT0+ lMahlklD2Nwta++oT/rmrFtJBIteAPjnuP7QygZQlNMLAbRh4ET5rPaq/I+LsWdJ42C4=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version: Content-Type:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=XsWRWDKv5SQtcHwa83Q9ThPJka5JNIx6EFWVy7tOeHA=; b=AYuq52BKOHMKUaTgaQXi6XIWWS IDdYdfajyAvFaOHJExnDH0aIE9FLtSxIqMLcWuN0rKB0KjZGiflLXu4ReIefaKID+cxX1q+G80r9z bg2m0rFFjj81hHbBhb5aDu2MhcwWo83Yh/cViUpUrWJE+qjrfqp1B+6jqsm/oRn9gN80=; Received: from mail-wm0-f68.google.com ([74.125.82.68]) by sfi-mx-3.v28.ch3.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.89) id 1eNEhq-0000ZW-Oz for openvpn-devel@lists.sourceforge.net; Fri, 08 Dec 2017 09:12:32 +0000 Received: by mail-wm0-f68.google.com with SMTP id f206so2100980wmf.5 for ; Fri, 08 Dec 2017 01:12:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=karger-me.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=XsWRWDKv5SQtcHwa83Q9ThPJka5JNIx6EFWVy7tOeHA=; b=yqpAjUh0lxsXnUy1b+Rah8XR2SCC9GT+AodLY8NvKOgsS3AxAkc/5dzP/d+BF4aMlG Q4CgtBX78QXBJy6bx1XGmlots9Rai0POFQEanyf/eJrEePS+KXobbOcVPl5U1b/sxDjG 2Ct3nFtF/fUV0+caXYkzzl3eFSi3tzGk/Sz/5icON7E7zi8cP4fQx1t0MBNI+UAddV1y 8B9v9MJ0I0JmHtJMms6Qxt7comTiThTLqaYu+UOOY2e80G8R4IB3Y/mYUMB/+islHLkn JKq4/ge7rD2wbaTnjyiir3t0afZK71wVrmboy2bMnv41ltkZempH1ZEe2mw5dbLlp+0Z kKJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=XsWRWDKv5SQtcHwa83Q9ThPJka5JNIx6EFWVy7tOeHA=; b=PEuFpSmZBWLq9q5LP3v+yXKxxwHRKMhvV4koHFFCaXWyqLIO4rYt1Plhwx3djJR6IY 3GqnAih5damnECTgyxwJL2nCtLW6juiHNMNjMLXkohQwrM0Elp389Zuegw6+vDycJbJn QpS6nSmKxJDJTxOePus3qAtkur1DsbB61MtJcfjW87De91UrLC+MyitEqA+T3Q+gGz2L hkdbFVo6p2uZL7zsFbI19HU+nwtOmhnPHP94jgEVNt25eDwJlAJN4Rcx/F6BZzmSjvdu GF9IQWdV2yyOTOhflOC0roBm7+B5sVtKJa8BZpSfYSSSSVJO+FiXCFwZ5aw/cT4V53al Mu+w== X-Gm-Message-State: AJaThX4ZWbBf5CZfwniK4XLVYivwb/2wGuQEvmOjI7vICGzUfIuF1xsr YNYnPGCWmcBt3rbqCi5uCZFSWHXlF7o= X-Google-Smtp-Source: AGs4zMbC3Lgty1T1zKigHFJREf5QWArsdXUEnvyuJM+0m6R78aPTZMNhQXeSKb+mi7jjwUGKmJd4Hw== X-Received: by 10.80.245.181 with SMTP id u50mr48857908edm.171.1512724344418; Fri, 08 Dec 2017 01:12:24 -0800 (PST) Received: from syzzer-tweakbak.fritz.box ([2001:985:e54:1:881e:647d:3c8e:6ee4]) by smtp.gmail.com with ESMTPSA id q10sm3216859edc.32.2017.12.08.01.12.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 08 Dec 2017 01:12:23 -0800 (PST) From: Steffan Karger To: openvpn-devel@lists.sourceforge.net Date: Fri, 8 Dec 2017 10:12:18 +0100 Message-Id: <1512724338-22197-1-git-send-email-steffan@karger.me> X-Mailer: git-send-email 2.7.4 X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [74.125.82.68 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-Headers-End: 1eNEhq-0000ZW-Oz Subject: [Openvpn-devel] [PATCH] Fix memory leak in buffer unit tests X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox buffer_list_push_data does not take ownership of the memory, so just feed it stack data to plug the leak. Signed-off-by: Steffan Karger Acked-by: Antonio Quartulli --- tests/unit_tests/openvpn/test_buffer.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/unit_tests/openvpn/test_buffer.c b/tests/unit_tests/openvpn/test_buffer.c index ba5aa67..c2b7f30 100644 --- a/tests/unit_tests/openvpn/test_buffer.c +++ b/tests/unit_tests/openvpn/test_buffer.c @@ -77,10 +77,9 @@ static int test_buffer_list_setup(void **state) buffer_list_push(ctx->zero_length_strings, ""); ctx->empty_buffers = buffer_list_new(2); - uint8_t *data1 = malloc(1); - uint8_t *data2 = malloc(1); - buffer_list_push_data(ctx->empty_buffers, data1, 0); - buffer_list_push_data(ctx->empty_buffers, data2, 0); + uint8_t data = 0; + buffer_list_push_data(ctx->empty_buffers, &data, 0); + buffer_list_push_data(ctx->empty_buffers, &data, 0); *state = ctx; return 0;