[PATCH] update-cache --refresh cache entry leak
When update-cache --refresh replaces an existing cache entry with a new one, it forgets to free the original. Signed-off-by: Junio C Hamano [EMAIL PROTECTED] --- update-cache.c: 61d2b93a751f35ba24f479cd4fc151188916f02a --- update-cache.c +++ update-cache.c 2005-04-16 15:49:03.0 -0700 @@ -203,6 +203,8 @@ printf(%s: needs update\n, ce-name); continue; } + if (new != ce) + free(ce); active_cache[i] = new; } } - To unsubscribe from this list: send the line unsubscribe git in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] update-cache --refresh cache entry leak
On Sat, 16 Apr 2005, Junio C Hamano wrote: When update-cache --refresh replaces an existing cache entry with a new one, it forgets to free the original. I've seen this patch now three times, and it's been wrong every single time. Maybe we should add a comment? That active-cache entry you free()'d was not necessarily allocated with malloc(). Most cache-entries are just mmap'ed directly from the index file. Leaking is ok. We cannot leak too much. Linus - To unsubscribe from this list: send the line unsubscribe git in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] update-cache --refresh cache entry leak
LT == Linus Torvalds [EMAIL PROTECTED] writes: LT I've seen this patch now three times, and it's been wrong every single LT time. Maybe we should add a comment? I found out the previous two just after I sent it out. Sorry about that. - To unsubscribe from this list: send the line unsubscribe git in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html