diff options
author | Peter Breitenlohner <peb@mppmu.mpg.de> | 2011-05-18 06:36:05 +0000 |
---|---|---|
committer | Peter Breitenlohner <peb@mppmu.mpg.de> | 2011-05-18 06:36:05 +0000 |
commit | 44e98ed6c0efe8227737e1df2df23550d8c790a9 (patch) | |
tree | ad9a4a938b9211c0ce1393ae50055edf1d3e5a18 /Build/source/texk/web2c/lib | |
parent | 160c15e5ecc6084ba75acf0d373278879f2150ec (diff) |
Avoid a small IPC memory leak
git-svn-id: svn://tug.org/texlive/trunk@22519 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/lib')
-rw-r--r-- | Build/source/texk/web2c/lib/ChangeLog | 7 | ||||
-rw-r--r-- | Build/source/texk/web2c/lib/texmfmp.c | 16 |
2 files changed, 10 insertions, 13 deletions
diff --git a/Build/source/texk/web2c/lib/ChangeLog b/Build/source/texk/web2c/lib/ChangeLog index 00e3fcebb6f..4ffd0c76b3b 100644 --- a/Build/source/texk/web2c/lib/ChangeLog +++ b/Build/source/texk/web2c/lib/ChangeLog @@ -1,6 +1,11 @@ +2011-05-18 Peter Breitenlohner <peb@mppmu.mpg.de> + + * texmfmp.c (ipcpage): Add 'free(cwd)'. + (generic_synctex_get_current_name): Use xgetcwd(). + 2011-05-12 Peter Breitenlohner <peb@mppmu.mpg.de> - texmfmp.c: Change arg2 of kpse_absolute_p() from `0' to `false'. + * texmfmp.c: Change arg2 of kpse_absolute_p() from `0' to `false'. 2011-05-11 Akira Kakuto <kakuto@fuk.kindai.ac.jp> diff --git a/Build/source/texk/web2c/lib/texmfmp.c b/Build/source/texk/web2c/lib/texmfmp.c index c9963ea9105..4e4c62419ec 100644 --- a/Build/source/texk/web2c/lib/texmfmp.c +++ b/Build/source/texk/web2c/lib/texmfmp.c @@ -95,23 +95,14 @@ SyncTeX file name should be full path in the case where --output-directory option is given. Borrowed from LuaTeX. - - The 2048 instead of a normal low number like 2. That is because - apparently glibc's |getcwd| is buggy: actually executing the - loop causes errors later on during execution even though the - initial function calls work just fine. (Taco). */ char *generic_synctex_get_current_name (void) { - char *pwdbuf = NULL, *ret; - int pwdbufsize = 2048; + char *pwdbuf, *ret; if (kpse_absolute_p(fullnameoffile, false)) { return xstrdup(fullnameoffile); } - do { - pwdbufsize = 2*pwdbufsize; - pwdbuf = xrealloc (pwdbuf, pwdbufsize); - } while (!getcwd(pwdbuf, pwdbufsize)); + pwdbuf = xgetcwd(); ret = concat3(pwdbuf, DIR_SEP_STRING, fullnameoffile); free(pwdbuf) ; return ret; @@ -1057,7 +1048,7 @@ ipc_snd (int n, int is_eof, char *data) /* This routine notifies the server if there is an eof, or the filename if a new DVI file is starting. This is the routine called by TeX. Aleph defines str_start(#) as str_start_ar[# - too_big_char], with - too_big_char = biggest_char + 1 = 65536 (omstr.ch).*/ + too_big_char = biggest_char + 1 = 65536 (omstr.ch). */ void ipcpage (int is_eof) @@ -1093,6 +1084,7 @@ ipcpage (int is_eof) been started up and running as a daemon, e.g., as with the NeXT preview program. */ p = concat3 (cwd, DIR_SEP_STRING, name); + free (cwd); free (name); len = strlen(p); begun = true; |