Re: [PATCH v4 14/14] read-cache.c: fix memory leaks caused by removed cache entries

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

 



Karsten Blees <karsten.blees@xxxxxxxxx> writes:

> diff --git a/builtin/update-index.c b/builtin/update-index.c
> index b654d27..acd992d 100644
> --- a/builtin/update-index.c
> +++ b/builtin/update-index.c
> @@ -559,6 +559,7 @@ static int do_reupdate(int ac, const char **av,
>  		const struct cache_entry *ce = active_cache[pos];
>  		struct cache_entry *old = NULL;
>  		int save_nr;
> +		const char *path;
>  
>  		if (ce_stage(ce) || !ce_path_match(ce, &pathspec))
>  			continue;
> @@ -575,7 +576,9 @@ static int do_reupdate(int ac, const char **av,
>  		 * or worse yet 'allow_replace', active_nr may decrease.
>  		 */
>  		save_nr = active_nr;
> -		update_one(ce->name);
> +		path = xstrdup(ce->name);
> +		update_one(path);
> +		free(path);
>  		if (save_nr != active_nr)
>  			goto redo;
>  	}

This also gets complaint from free() that does not want to free a
const pointer.  I'll fix it up locally to get it compile before
queuing it to 'pu'.

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[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]