dthelp/FormatUtils: fix coredump in dthelpgen due to free() of a bad address
This commit is contained in:
@@ -583,13 +583,11 @@ _DtHelpGetNxtToken (
|
|||||||
/* Str is pointing at the start of the next token. Depending on the
|
/* Str is pointing at the start of the next token. Depending on the
|
||||||
type of token, malloc the memory and copy the token value. */
|
type of token, malloc the memory and copy the token value. */
|
||||||
if (*str == '\0')
|
if (*str == '\0')
|
||||||
token = str;
|
token = strdup(str);
|
||||||
|
|
||||||
else if (*str == '\n') {
|
else if (*str == '\n') {
|
||||||
token = str;
|
token = strdup(str);
|
||||||
str++;
|
str++;
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
/* We have some non-whitespace characters. Find the end of */
|
/* We have some non-whitespace characters. Find the end of */
|
||||||
/* them and copy them into new memory. */
|
/* them and copy them into new memory. */
|
||||||
|
|||||||
Reference in New Issue
Block a user