[File] Fix memory leak

Christos Zoulas christos at zoulas.com
Sat Jun 6 15:33:41 UTC 2020


Committed, thanks!

christos

> On Jun 6, 2020, at 11:16 AM, Steve Grubb <sgrubb at redhat.com> wrote:
> 
> Hello,
> 
> I was running static analysis and it found a memory leak.
> 
> Signed-off-by: Steve Grubb <sgrubb at redhat.com>
> 
> 
> diff --git a/src/ascmagic.c b/src/ascmagic.c
> index 3bb73597..f2dfd155 100644
> --- a/src/ascmagic.c
> +++ b/src/ascmagic.c
> @@ -164,8 +164,10 @@ file_ascmagic_with_encoding(struct magic_set *ms,
> 			goto done;
> 		}
> 	}
> -	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION)))
> -		return 0;
> +	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))) {
> +		rv = 0;
> +		goto done;
> +	}
> 
> 	/* Now try to discover other details about the file. */
> 	for (i = 0; i < ulen; i++) {
> 
> 
> 
> --
> File mailing list
> File at astron.com
> https://mailman.astron.com/mailman/listinfo/file

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 235 bytes
Desc: Message signed with OpenPGP
URL: <https://mailman.astron.com/pipermail/file/attachments/20200606/57135a8c/attachment.asc>


More information about the File mailing list