summaryrefslogtreecommitdiff
path: root/xserver/hw/xfree86/parser/scan.c
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2024-11-05 08:13:07 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2024-11-05 08:13:07 +0000
commit3ced31dfa7da11653ae880c2776cbf2e2256a009 (patch)
tree981ca5d9ba5a6d1f1cf8b8685faf120dd8c5c96c /xserver/hw/xfree86/parser/scan.c
parent939fde46a015afeec2b96b5cb6d0cc8aefe54c3d (diff)
Update to xserver 21.1.14. tested by tb@
The xkb security fix was committed earlier. This is the rest of the 21.1.14 update.
Diffstat (limited to 'xserver/hw/xfree86/parser/scan.c')
-rw-r--r--xserver/hw/xfree86/parser/scan.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/xserver/hw/xfree86/parser/scan.c b/xserver/hw/xfree86/parser/scan.c
index 1eb35ed73..f4645f9d9 100644
--- a/xserver/hw/xfree86/parser/scan.c
+++ b/xserver/hw/xfree86/parser/scan.c
@@ -332,10 +332,10 @@ xf86getToken(const xf86ConfigSymTabRec * tab)
}
while ((c != '\n') && (c != '\r') && (c != '\0'));
configRBuf[i] = '\0';
- /* XXX no private copy.
+ /* XXX private copy.
* Use xf86addComment when setting a comment.
*/
- xf86_lex_val.str = configRBuf;
+ xf86_lex_val.str = strdup(configRBuf);
return COMMENT;
}
@@ -448,8 +448,11 @@ xf86getSubToken(char **comment)
for (;;) {
token = xf86getToken(NULL);
if (token == COMMENT) {
- if (comment)
+ if (comment) {
*comment = xf86addComment(*comment, xf86_lex_val.str);
+ free(xf86_lex_val.str);
+ xf86_lex_val.str = NULL;
+ }
}
else
return token;
@@ -464,8 +467,11 @@ xf86getSubTokenWithTab(char **comment, const xf86ConfigSymTabRec * tab)
for (;;) {
token = xf86getToken(tab);
if (token == COMMENT) {
- if (comment)
+ if (comment) {
*comment = xf86addComment(*comment, xf86_lex_val.str);
+ free(xf86_lex_val.str);
+ xf86_lex_val.str = NULL;
+ }
}
else
return token;