parser/inpgtok.c, bug fix, introduced in "memory leaks: code improved"

commit "memory leaks: code improved"
Date:   Sun Apr 5 08:57:55 2009 +0000

'point' has not been incremented for so called
   "Weird items" with string length == 1
This commit is contained in:
rlar 2015-02-28 10:44:45 +01:00
parent 3c133c95b3
commit 4ae35e8974
1 changed files with 6 additions and 4 deletions

View File

@ -95,9 +95,10 @@ int INPgetTok(char **line, char **token, int gobble)
}
if (point == *line && *point) /* Weird items, 1 char */
point++;
diffpoints = (int)(point - *line);
if ((diffpoints < 1) && *point)
diffpoints = 1; /* Weird items, 1 char */
*token = TMALLOC(char, 1 + diffpoints);
if (!*token)
return (E_NOMEM);
@ -190,10 +191,11 @@ int INPgetNetTok(char **line, char **token, int gobble)
break;
}
if (point == *line && *point) /* Weird items, 1 char */
point++;
/* now copy found token into *token */
diffpoints = (int)(point - *line);
if ((diffpoints < 1) && *point)
diffpoints = 1; /* Weird items, 1 char */
*token = TMALLOC(char, 1 + diffpoints);
if (!*token)
return (E_NOMEM);