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 <rctay89@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Tay Ray Chuan committed
Aug 31, 2011 at 12:48 UTC
2738bc3f09fa1baa3e664a6389394ca51e4fd376
1 file changed
+2
xdiff/xprepare.c
+2
@@ -239,6 +239,8 @@ int xdl_prepare_env(mmfile_t *mf1, mmfile_t *mf2, xpparam_t const *xpp,
239
long enl1, enl2, sample;
240
xdlclassifier_t cf;
241
242
+ memset(&cf, 0, sizeof(cf));
243
+
244
/*
245
* For histogram diff, we can afford a smaller sample size and
246
* thus a poorer estimate of the number of lines, as the hash