From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 33128A0C4C for ; Mon, 12 Jul 2021 15:11:53 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 28A4C4069D; Mon, 12 Jul 2021 15:11:53 +0200 (CEST) Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) by mails.dpdk.org (Postfix) with ESMTP id 2C089411A1 for ; Mon, 12 Jul 2021 15:11:51 +0200 (CEST) Received: by mail-wr1-f47.google.com with SMTP id f9so19884369wrq.11 for ; Mon, 12 Jul 2021 06:11:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4DASNUJpnSEuCizAzWm27VDEsMSn0cV6C5coszjMud0=; b=PQrjXfXj1E5MFHK3Y8EnmFXonxACoxmNkWtqXAXussgRGSUDzDRo6P14J+/67xQCC0 xib2okJhDpoJjak5FJXqUfwMtvox7m8TQurg/e85lBoI3N9nKUzdfRiuepRztIXXKjQK AmqripIjqDsHGRPkmQZufmvfXtCXliNfsFo1vt/CnvzubEnEk664F8NswyYQKy9USr5+ SrQludtanXAg/Tw8PB4HXTGBW2X2QjBmBwI/ToIbnPt5gP3oIQ6DYnLHiZZaiqQw3mIB NLGOoYgTA6vLD0xUsREGCW2zhGhccXb5oFK/ELIfq8HQd2nENLUaPIQSP8XHUE4ccgk1 1M/Q== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=4DASNUJpnSEuCizAzWm27VDEsMSn0cV6C5coszjMud0=; b=rsykM+lApqi+CR3AeviRDUgrxxsY4OPKz0AXZx9RjIR5dWoB7lk9PtXJadKCqFjW9i f6P5jVBAwGmcpIDnw7QA9io3cxXAdBgDaMIDPtahSt9p7l0ubWde4AcP5NSlHG3nrxc4 Hd476/L9VOipQfSlUS0uTe1iLBzAglrVEUdHSkfVGIJ8RYySUg7fmgQuuPBRDZHSNrYU bFWrZI4/ktFsQcpK5qEfw1igFAJPGpQT0b3ebSyb0wv4QaEnBOj1n5TfUIly4/U2vjjM bpnThKOPeq6aT4pN/6/plDi5q/y88HL4JHhxQ24l8viLJKG03P0s8oQHFSH/YWUriaPj OEZw== X-Gm-Message-State: AOAM533NlijiVvpS9V5g6YyjNtPjE6tXL0cpriZ9Z9aRw5um+zj+cOwK BwTRMmWOJ1+jsnOhZkEhrss= X-Google-Smtp-Source: ABdhPJzpczFiAAPlpYtYNFSzQclYWKPwobKyOPtJ6hr81ASy55ZjWYgK4pi8dXNJWNVePlEVWMKExA== X-Received: by 2002:adf:e2cf:: with SMTP id d15mr59026851wrj.359.1626095511018; Mon, 12 Jul 2021 06:11:51 -0700 (PDT) Received: from localhost ([137.220.125.106]) by smtp.gmail.com with ESMTPSA id a64sm12361948wme.8.2021.07.12.06.11.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Jul 2021 06:11:50 -0700 (PDT) From: luca.boccassi@gmail.com To: Owen Hilyard Cc: David Marchand , Olivier Matz , dpdk stable Date: Mon, 12 Jul 2021 14:04:30 +0100 Message-Id: <20210712130551.2462159-35-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210712130551.2462159-1-luca.boccassi@gmail.com> References: <20210712130551.2462159-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'tests/cmdline: fix memory leaks' has been queued to stable release 20.11.3 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to stable release 20.11.3 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 07/14/21. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/e62869e7769a670d5feef0e41d3630177ab54dd2 Thanks. Luca Boccassi --- >From e62869e7769a670d5feef0e41d3630177ab54dd2 Mon Sep 17 00:00:00 2001 From: Owen Hilyard Date: Wed, 23 Jun 2021 14:06:45 -0400 Subject: [PATCH] tests/cmdline: fix memory leaks [ upstream commit ca7204b921c2f328ab1222772af40922970e7c4b ] Fixes for a few memory leaks in the cmdline_autotest unit test. All of the leaks were related to not freeing the commandline struct after testing had completed. Fixes: dbb860e03eb1 ("cmdline: tests") Signed-off-by: Owen Hilyard Reviewed-by: David Marchand Acked-by: Olivier Matz --- app/test/test_cmdline_lib.c | 39 +++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/app/test/test_cmdline_lib.c b/app/test/test_cmdline_lib.c index bd72df0da2..d5a09b4541 100644 --- a/app/test/test_cmdline_lib.c +++ b/app/test/test_cmdline_lib.c @@ -71,10 +71,12 @@ test_cmdline_parse_fns(void) if (cmdline_complete(cl, "buffer", &i, NULL, sizeof(dst)) >= 0) goto error; + cmdline_free(cl); return 0; error: printf("Error: function accepted null parameter!\n"); + cmdline_free(cl); return -1; } @@ -140,22 +142,31 @@ static int test_cmdline_socket_fns(void) { cmdline_parse_ctx_t ctx; + struct cmdline *cl; - if (cmdline_stdin_new(NULL, "prompt") != NULL) + cl = cmdline_stdin_new(NULL, "prompt"); + if (cl != NULL) goto error; - if (cmdline_stdin_new(&ctx, NULL) != NULL) + cl = cmdline_stdin_new(&ctx, NULL); + if (cl != NULL) goto error; - if (cmdline_file_new(NULL, "prompt", "/dev/null") != NULL) + cl = cmdline_file_new(NULL, "prompt", "/dev/null"); + if (cl != NULL) goto error; - if (cmdline_file_new(&ctx, NULL, "/dev/null") != NULL) + cl = cmdline_file_new(&ctx, NULL, "/dev/null"); + if (cl != NULL) goto error; - if (cmdline_file_new(&ctx, "prompt", NULL) != NULL) + cl = cmdline_file_new(&ctx, "prompt", NULL); + if (cl != NULL) goto error; - if (cmdline_file_new(&ctx, "prompt", "-/invalid/~/path") != NULL) { + cl = cmdline_file_new(&ctx, "prompt", "-/invalid/~/path"); + if (cl != NULL) { printf("Error: succeeded in opening invalid file for reading!"); + cmdline_free(cl); return -1; } - if (cmdline_file_new(&ctx, "prompt", "/dev/null") == NULL) { + cl = cmdline_file_new(&ctx, "prompt", "/dev/null"); + if (cl == NULL) { printf("Error: failed to open /dev/null for reading!"); return -1; } @@ -163,9 +174,11 @@ test_cmdline_socket_fns(void) /* void functions */ cmdline_stdin_exit(NULL); + cmdline_free(cl); return 0; error: printf("Error: function accepted null parameter!\n"); + cmdline_free(cl); return -1; } @@ -176,14 +189,15 @@ test_cmdline_fns(void) struct cmdline *cl; memset(&ctx, 0, sizeof(ctx)); + cl = cmdline_new(NULL, "prompt", 0, 0); + if (cl != NULL) + goto error; + cl = cmdline_new(&ctx, NULL, 0, 0); + if (cl != NULL) + goto error; cl = cmdline_new(&ctx, "test", -1, -1); if (cl == NULL) goto error; - - if (cmdline_new(NULL, "prompt", 0, 0) != NULL) - goto error; - if (cmdline_new(&ctx, NULL, 0, 0) != NULL) - goto error; if (cmdline_in(NULL, "buffer", CMDLINE_TEST_BUFSIZE) >= 0) goto error; if (cmdline_in(cl, NULL, CMDLINE_TEST_BUFSIZE) >= 0) @@ -198,6 +212,7 @@ test_cmdline_fns(void) cmdline_interact(NULL); cmdline_quit(NULL); + cmdline_free(cl); return 0; error: -- 2.30.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-07-12 13:41:38.519547996 +0100 +++ 0035-tests-cmdline-fix-memory-leaks.patch 2021-07-12 13:41:36.298118611 +0100 @@ -1 +1 @@ -From ca7204b921c2f328ab1222772af40922970e7c4b Mon Sep 17 00:00:00 2001 +From e62869e7769a670d5feef0e41d3630177ab54dd2 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit ca7204b921c2f328ab1222772af40922970e7c4b ] + @@ -12 +13,0 @@ -Cc: stable@dpdk.org