summaryrefslogtreecommitdiff
path: root/diffcore-pickaxe.c
diff options
context:
space:
mode:
authorRené Scharfe <rene.scharfe@lsrfire.ath.cx>2011-10-06 18:03:35 +0200
committerJunio C Hamano <gitster@pobox.com>2011-10-07 15:46:12 -0700
commit05ac978495e84fe03d91ab591524b7ea138900ed (patch)
tree3236dfbac92de4c0578ee2e038e54286a0693e8f /diffcore-pickaxe.c
parent703f05ad5835cff92b12c29aecf8d724c8c847e2 (diff)
downloadgit-05ac978495e84fe03d91ab591524b7ea138900ed.tar.gz
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 <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diffcore-pickaxe.c')
-rw-r--r--diffcore-pickaxe.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/diffcore-pickaxe.c b/diffcore-pickaxe.c
index c3760cfefd..0835a3be8d 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;