Skip to content

Commit 2738bc3

Browse files
rctaygitster
authored andcommitted
xdiff/xprepare: initialise xdlclassifier_t cf in xdl_prepare_env()
Ensure that the xdl_free_classifier() call on xdlclassifier_t cf is safe even if xdl_init_classifier() isn't called. This may occur in the case where diff is run with --histogram and a call to, say, xdl_prepare_ctx() fails. Signed-off-by: Tay Ray Chuan <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6486a84 commit 2738bc3

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

xdiff/xprepare.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,8 @@ int xdl_prepare_env(mmfile_t *mf1, mmfile_t *mf2, xpparam_t const *xpp,
239239
long enl1, enl2, sample;
240240
xdlclassifier_t cf;
241241

242+
memset(&cf, 0, sizeof(cf));
243+
242244
/*
243245
* For histogram diff, we can afford a smaller sample size and
244246
* thus a poorer estimate of the number of lines, as the hash

0 commit comments

Comments
 (0)