Source: texlive-bin Version: 2014.20140528.34243-5 Severity: normal Tags: patch
There seems to be a memory leak in the implementation of _synctex_open. build_output points to a memory location acquired with malloc, but build_output is never passed to free. The attached patch adds the necessary calls to clean up the allocated memory. Cheers -- Sebastian Ramacher
--- texlive-bin-2014.20140528.34243.orig/texk/web2c/synctexdir/synctex_parser.c
+++ texlive-bin-2014.20140528.34243/texk/web2c/synctexdir/synctex_parser.c
@@ -2878,6 +2878,7 @@ int _synctex_open(const char * output, c
build_output[0] = '\0';
} else {
if (build_output != strcpy(build_output,output)) {
+ free(build_output);
return -4;
}
build_output[lpc-output]='\0';
@@ -2886,15 +2887,20 @@ int _synctex_open(const char * output, c
/* Append a path separator if necessary. */
if (!SYNCTEX_IS_PATH_SEPARATOR(build_output[strlen(build_directory)-1])) {
if (build_output != strcat(build_output,"/")) {
+ free(build_output);
return -2;
}
}
/* Append the last path component of the output. */
if (build_output != strcat(build_output,lpc)) {
+ free(build_output);
return -3;
}
- return __synctex_open(build_output,synctex_name_ref,file_ref,add_quotes,io_mode_ref);
+ int result = __synctex_open(build_output,synctex_name_ref,file_ref,add_quotes,io_mode_ref);
+ free(build_output);
+ return result;
}
+ free(build_output);
}
return -1;
}
signature.asc
Description: Digital signature

