diff mbox series

show_archive_content: Fix trivial memory leak

Message ID 20210511171738.360327-1-siddhesh@sourceware.org
State Committed
Commit 2317101658488102f54d4c700fd2da839b6fec29
Headers show
Series show_archive_content: Fix trivial memory leak | expand

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent

Commit Message

Siddhesh Poyarekar May 11, 2021, 5:17 p.m. UTC
Fix trivial leak identified by coverity.  The program runs to exit and
the leak doesn't grow, but it's just cleaner to free the allocated
memory.
---
 locale/programs/locarchive.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Siddhesh Poyarekar May 17, 2021, 3:59 p.m. UTC | #1
Ping!  I'll push this in a couple of days if there are no objections 
since it is a pretty trivial fix.

Siddhesh

On 5/11/21 10:47 PM, Siddhesh Poyarekar via Libc-alpha wrote:
> Fix trivial leak identified by coverity.  The program runs to exit and
> the leak doesn't grow, but it's just cleaner to free the allocated
> memory.
> ---
>   locale/programs/locarchive.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/locale/programs/locarchive.c b/locale/programs/locarchive.c
> index 6bb189ae37..f38e835c52 100644
> --- a/locale/programs/locarchive.c
> +++ b/locale/programs/locarchive.c
> @@ -1742,6 +1742,7 @@ show_archive_content (const char *fname, int verbose)
>   			: locnames[idx]);
>   	      }
>   	}
> +      free (files);
>       }
>     else
>       for (cnt = 0; cnt < used; ++cnt)
>
Adhemerval Zanella May 17, 2021, 5:04 p.m. UTC | #2
On 11/05/2021 14:17, Siddhesh Poyarekar via Libc-alpha wrote:
> Fix trivial leak identified by coverity.  The program runs to exit and
> the leak doesn't grow, but it's just cleaner to free the allocated
> memory.

LGTM, thanks.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

> ---
>  locale/programs/locarchive.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/locale/programs/locarchive.c b/locale/programs/locarchive.c
> index 6bb189ae37..f38e835c52 100644
> --- a/locale/programs/locarchive.c
> +++ b/locale/programs/locarchive.c
> @@ -1742,6 +1742,7 @@ show_archive_content (const char *fname, int verbose)
>  			: locnames[idx]);
>  	      }
>  	}
> +      free (files);
>      }
>    else
>      for (cnt = 0; cnt < used; ++cnt)
>
diff mbox series

Patch

diff --git a/locale/programs/locarchive.c b/locale/programs/locarchive.c
index 6bb189ae37..f38e835c52 100644
--- a/locale/programs/locarchive.c
+++ b/locale/programs/locarchive.c
@@ -1742,6 +1742,7 @@  show_archive_content (const char *fname, int verbose)
 			: locnames[idx]);
 	      }
 	}
+      free (files);
     }
   else
     for (cnt = 0; cnt < used; ++cnt)