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:
parent
3c133c95b3
commit
4ae35e8974
|
|
@ -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);
|
diffpoints = (int)(point - *line);
|
||||||
if ((diffpoints < 1) && *point)
|
|
||||||
diffpoints = 1; /* Weird items, 1 char */
|
|
||||||
*token = TMALLOC(char, 1 + diffpoints);
|
*token = TMALLOC(char, 1 + diffpoints);
|
||||||
if (!*token)
|
if (!*token)
|
||||||
return (E_NOMEM);
|
return (E_NOMEM);
|
||||||
|
|
@ -190,10 +191,11 @@ int INPgetNetTok(char **line, char **token, int gobble)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (point == *line && *point) /* Weird items, 1 char */
|
||||||
|
point++;
|
||||||
|
|
||||||
/* now copy found token into *token */
|
/* now copy found token into *token */
|
||||||
diffpoints = (int)(point - *line);
|
diffpoints = (int)(point - *line);
|
||||||
if ((diffpoints < 1) && *point)
|
|
||||||
diffpoints = 1; /* Weird items, 1 char */
|
|
||||||
*token = TMALLOC(char, 1 + diffpoints);
|
*token = TMALLOC(char, 1 + diffpoints);
|
||||||
if (!*token)
|
if (!*token)
|
||||||
return (E_NOMEM);
|
return (E_NOMEM);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue