From: René Scharfe Date: Thu, 6 Oct 2011 16:03:35 +0000 (+0200) Subject: pickaxe: plug diff filespec leak with empty needle X-Git-Tag: v1.7.8-rc0~38^2~6 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=05ac978495e84fe03d91ab591524b7ea138900ed;p=git-core%2Fgit.git pickaxe: plug diff filespec leak with empty needle Check first for the unlikely case of an empty needle string and only then populate the filespec, lest we leak it. Signed-off-by: Rene Scharfe Signed-off-by: Junio C Hamano --- diff --git a/diffcore-pickaxe.c b/diffcore-pickaxe.c index c3760cfef..0835a3be8 100644 --- a/diffcore-pickaxe.c +++ b/diffcore-pickaxe.c @@ -152,10 +152,10 @@ static unsigned int contains(struct diff_filespec *one, unsigned int cnt; unsigned long sz; const char *data; - if (diff_populate_filespec(one, 0)) - return 0; if (!len) return 0; + if (diff_populate_filespec(one, 0)) + return 0; sz = one->size; data = one->data;