Re: [PATCH v2 1/3] unpack-trees: don't leak memory in verify_clean_subdirectory()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ævar Arnfjörð Bjarmason  <avarab@xxxxxxxxx> writes:

> diff --git a/unpack-trees.c b/unpack-trees.c
> index a7e1712d236..89ca95ce90b 100644
> --- a/unpack-trees.c
> +++ b/unpack-trees.c
> @@ -2156,9 +2156,10 @@ static int verify_clean_subdirectory(const struct cache_entry *ce,
>  	if (o->dir)
>  		d.exclude_per_dir = o->dir->exclude_per_dir;
>  	i = read_directory(&d, o->src_index, pathbuf, namelen+1, NULL);
> +	dir_clear(&d);
> +	free(pathbuf);
>  	if (i)
>  		return add_rejected_path(o, ERROR_NOT_UPTODATE_DIR, ce->name);
> -	free(pathbuf);
>  	return cnt;
>  }

Looks trivially correct.





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux