Skip to content

Commit

Permalink
pickaxe: plug diff filespec leak with empty needle
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
René Scharfe authored and Junio C Hamano committed Oct 7, 2011
1 parent 703f05a commit 05ac978
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions diffcore-pickaxe.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 05ac978

Please sign in to comment.