Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 56da07c

Browse files
pks-tEdward Thomson
authored and
Edward Thomson
committed
xdiff/xprepare: fix a memory leak
The xdl_prepare_env() function may initialise an xdlclassifier_t data structure via xdl_init_classifier(), which allocates memory to several fields, for example 'rchash', 'rcrecs' and 'ncha'. If this function later exits due to the failure of xdl_optimize_ctxs(), then this xdlclassifier_t structure, and the memory allocated to it, is not cleaned up. In order to fix the memory leak, insert a call to xdl_free_classifier() before returning. This patch was originally written by Ramsay Jones (see commit 87f16258367a3b9a62663b11f898a4a6f3c19d31 in git.git).
1 parent 3ec0f2e commit 56da07c

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/xdiff/xprepare.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@ int xdl_prepare_env(mmfile_t *mf1, mmfile_t *mf2, xpparam_t const *xpp,
301301

302302
xdl_free_ctx(&xe->xdf2);
303303
xdl_free_ctx(&xe->xdf1);
304+
xdl_free_classifier(&cf);
304305
return -1;
305306
}
306307

0 commit comments

Comments
 (0)