tests/test_eal_flags: fix memory leak

Message ID 20210616162453.349614-1-ohilyard@iol.unh.edu (mailing list archive)
State Accepted, archived
Delegated to: David Marchand
Headers
Series tests/test_eal_flags: fix memory leak |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/github-robot success github build: passed
ci/iol-abi-testing success Testing PASS
ci/iol-testing fail Testing issues
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-mellanox-Functional fail Functional Testing issues

Commit Message

Owen Hilyard June 16, 2021, 4:24 p.m. UTC
  From: Owen Hilyard <ohilyard@iol.unh.edu>

The directory steam was not closed when the hugepage action was
HUGEPAGE_CHECK_EXISTS. This caused a memory leak in some parts of
the unit tests.

Signed-off-by: Owen Hilyard <ohilyard@iol.unh.edu>
---
 app/test/test_eal_flags.c | 1 +
 1 file changed, 1 insertion(+)
  

Comments

David Marchand June 16, 2021, 4:37 p.m. UTC | #1
On Wed, Jun 16, 2021 at 6:26 PM <ohilyard@iol.unh.edu> wrote:
>
> From: Owen Hilyard <ohilyard@iol.unh.edu>
>
> The directory steam was not closed when the hugepage action was
> HUGEPAGE_CHECK_EXISTS. This caused a memory leak in some parts of
> the unit tests.
>
> Signed-off-by: Owen Hilyard <ohilyard@iol.unh.edu>

Reviewed-by: David Marchand <david.marchand@redhat.com>
  
David Marchand June 16, 2021, 4:50 p.m. UTC | #2
On Wed, Jun 16, 2021 at 6:37 PM David Marchand
<david.marchand@redhat.com> wrote:
>
> On Wed, Jun 16, 2021 at 6:26 PM <ohilyard@iol.unh.edu> wrote:
> >
> > From: Owen Hilyard <ohilyard@iol.unh.edu>
> >
> > The directory steam was not closed when the hugepage action was
> > HUGEPAGE_CHECK_EXISTS. This caused a memory leak in some parts of
> > the unit tests.

Just forgot to ask for a Fixes: tag.
I guess this is:
Fixes: 45f1b6e8680a ("app: add new tests on eal flags")

I will add it when applying.
  
David Marchand June 24, 2021, 1:26 p.m. UTC | #3
On Wed, Jun 16, 2021 at 6:26 PM <ohilyard@iol.unh.edu> wrote:
>
> From: Owen Hilyard <ohilyard@iol.unh.edu>
>
> The directory steam was not closed when the hugepage action was
> HUGEPAGE_CHECK_EXISTS. This caused a memory leak in some parts of
> the unit tests.
>

Fixes: 45f1b6e8680a ("app: add new tests on eal flags")
Cc: stable@dpdk.org


> Signed-off-by: Owen Hilyard <ohilyard@iol.unh.edu>
Reviewed-by: David Marchand <david.marchand@redhat.com>

Applied, thanks.
  

Patch

diff --git a/app/test/test_eal_flags.c b/app/test/test_eal_flags.c
index 932fbe3d0..0c1e0fb21 100644
--- a/app/test/test_eal_flags.c
+++ b/app/test/test_eal_flags.c
@@ -125,6 +125,7 @@  process_hugefiles(const char * prefix, enum hugepage_action action)
 				{
 					/* file exists, return */
 					result = 1;
+					closedir(hugepage_dir);
 					goto end;
 				}
 				break;