diff options
author | Takuji Tanaka <KXD02663@nifty.ne.jp> | 2014-07-05 08:28:34 +0000 |
---|---|---|
committer | Takuji Tanaka <KXD02663@nifty.ne.jp> | 2014-07-05 08:28:34 +0000 |
commit | 1e848803b9050bf3aefd1afd48fc8c76475849a9 (patch) | |
tree | 4ae2883776635d721e60840bd8f7fc0243d8b71e | |
parent | 25be614f4a9b0e6eaf0709ef56d1947528e2bcc4 (diff) |
texk/mendexk: Better timing for xstrdup
git-svn-id: svn://tug.org/texlive/trunk@34527 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Build/source/texk/mendexk/ChangeLog | 4 | ||||
-rw-r--r-- | Build/source/texk/mendexk/convert.c | 9 |
2 files changed, 9 insertions, 4 deletions
diff --git a/Build/source/texk/mendexk/ChangeLog b/Build/source/texk/mendexk/ChangeLog index c1eb16fdd5f..6f1b0506a67 100644 --- a/Build/source/texk/mendexk/ChangeLog +++ b/Build/source/texk/mendexk/ChangeLog @@ -1,3 +1,7 @@ +2014-07-05 TANAKA Takuji <KXD02663@nifty.ne.jp> + + * convert.c: Better timing for xstrdup. + 2014-06-25 Peter Breitenlohner <peb@mppmu.mpg.de> * main.c: Drop definition of TL_VERSION. diff --git a/Build/source/texk/mendexk/convert.c b/Build/source/texk/mendexk/convert.c index ce89c06f7fe..24aeecd7b1f 100644 --- a/Build/source/texk/mendexk/convert.c +++ b/Build/source/texk/mendexk/convert.c @@ -151,21 +151,22 @@ static int dicvalread(const char *filename, struct dictionary *dicval, int line) buff2[k]=buff[j]; } buff2[k]='\0'; - dicval[i].dic[0]=xstrdup(buff2); - if (strlen(dicval[i].dic[0])==0) { + if (strlen(buff2)==0) { i--; continue; } + dicval[i].dic[0]=xstrdup(buff2); for (;((buff[j]==' ')||(buff[j]=='\t'));j++); for (k=0;((buff[j]!='\r')&&(buff[j]!='\n')&&(buff[j]!=' ')&&(buff[j]!='\t'));j++,k++) { buff2[k]=buff[j]; } buff2[k]='\0'; - dicval[i].dic[1]=xstrdup(buff2); - if (strlen(dicval[i].dic[1])==0) { + if (strlen(buff2)==0) { + free(dicval[i].dic[0]); i--; continue; } + dicval[i].dic[1]=xstrdup(buff2); convert(dicval[i].dic[1],buff); strcpy(dicval[i].dic[1],buff); |