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>
This commit is contained in:
parent
703f05ad58
commit
05ac978495
@ -152,10 +152,10 @@ static unsigned int contains(struct diff_filespec *one,
|
|||||||
unsigned int cnt;
|
unsigned int cnt;
|
||||||
unsigned long sz;
|
unsigned long sz;
|
||||||
const char *data;
|
const char *data;
|
||||||
if (diff_populate_filespec(one, 0))
|
|
||||||
return 0;
|
|
||||||
if (!len)
|
if (!len)
|
||||||
return 0;
|
return 0;
|
||||||
|
if (diff_populate_filespec(one, 0))
|
||||||
|
return 0;
|
||||||
|
|
||||||
sz = one->size;
|
sz = one->size;
|
||||||
data = one->data;
|
data = one->data;
|
||||||
|
Loading…
Reference in New Issue
Block a user