From: Tay Ray Chuan Date: Wed, 31 Aug 2011 04:48:46 +0000 (+0800) Subject: xdiff/xprepare: initialise xdlclassifier_t cf in xdl_prepare_env() X-Git-Tag: v1.7.7-rc1~7^2 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=2738bc3f09fa1baa3e664a6389394ca51e4fd376;p=git.git 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 Signed-off-by: Junio C Hamano --- diff --git a/xdiff/xprepare.c b/xdiff/xprepare.c index 620fc9a65..5b676b7ca 100644 --- a/xdiff/xprepare.c +++ b/xdiff/xprepare.c @@ -239,6 +239,8 @@ int xdl_prepare_env(mmfile_t *mf1, mmfile_t *mf2, xpparam_t const *xpp, long enl1, enl2, sample; xdlclassifier_t cf; + memset(&cf, 0, sizeof(cf)); + /* * For histogram diff, we can afford a smaller sample size and * thus a poorer estimate of the number of lines, as the hash