Browse code

Fix bug in msxml_parse_element which may leave behind empty temp file and leak a little memory

Anthony Chan authored on 2016/07/08 07:27:47
Showing 1 changed files
... ...
@@ -444,6 +444,9 @@ static int msxml_parse_element(struct msxml_ctx *mxctx, xmlTextReaderPtr reader,
444 444
                     if(cli_writen(of, decoded, decodedlen) != (int)decodedlen) {
445 445
                         free(decoded);
446 446
                         close(of);
447
+                        if (ctx && !(ctx->engine->keeptmp))
448
+                            cli_unlink(tempfile);
449
+                        free(tempfile);
447 450
                         return CL_EWRITE;
448 451
                     }
449 452
                     free(decoded);