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 | |
parent | 160c15e5ecc6084ba75acf0d373278879f2150ec (diff) |
Avoid a small IPC memory leak
git-svn-id: svn://tug.org/texlive/trunk@22519 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Build/source/texk/web2c/lib/ChangeLog | 7 | ||||
-rw-r--r-- | Build/source/texk/web2c/lib/texmfmp.c | 16 | ||||
-rw-r--r-- | Build/source/texk/web2c/luatexdir/ChangeLog | 7 | ||||
-rw-r--r-- | Build/source/texk/web2c/luatexdir/luatex.c | 7 |
4 files changed, 19 insertions, 18 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; diff --git a/Build/source/texk/web2c/luatexdir/ChangeLog b/Build/source/texk/web2c/luatexdir/ChangeLog index fd48641ab41..b4a8d50d3c3 100644 --- a/Build/source/texk/web2c/luatexdir/ChangeLog +++ b/Build/source/texk/web2c/luatexdir/ChangeLog @@ -1,14 +1,21 @@ +2011-05-18 Peter Breitenlohner <peb@mppmu.mpg.de> + + * luatex.c (ipcpage): Add 'free(cwd)', remove Aleph comment. + 2011-05-17 Taco Hoekwater <taco@luatex.org> + * tex/texfileio.w (luatex_synctex_get_current_name): switch to xgetcwd() from kpathsea * luatex_svnversion.h: updated to reflect latest luatex revision (4272) 2011-05-15 Taco Hoekwater <taco@luatex.org> + * tex/texfileio.w (luatex_synctex_get_current_name): work around a bug in getcwd(). * luatex_svnversion.h: updated to reflect latest luatex revision (4267) 2011-05-13 Taco Hoekwater <taco@luatex.org> + * lua/luainit.w: change the copyright year to 2011. * luatex_svnversion.h: updated to reflect latest luatex revision (4264) * NEWS: forgot to mention synctex change diff --git a/Build/source/texk/web2c/luatexdir/luatex.c b/Build/source/texk/web2c/luatexdir/luatex.c index a257b60e383..2b22b3490bd 100644 --- a/Build/source/texk/web2c/luatexdir/luatex.c +++ b/Build/source/texk/web2c/luatexdir/luatex.c @@ -654,10 +654,7 @@ static void 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).*/ - + if a new DVI file is starting. This is the routine called by TeX. */ void ipcpage(int is_eof) { static boolean begun = false; @@ -675,7 +672,7 @@ void ipcpage(int is_eof) preview program. */ name = static_pdf->file_name; p = concat3(cwd, DIR_SEP_STRING, name); - /* free(name); */ + free(cwd); len = strlen(p); begun = true; } |