summaryrefslogtreecommitdiff
path: root/parser.c
diff options
context:
space:
mode:
authorAlex Elder <elder@linaro.org>2021-10-01 18:23:10 -0500
committerBjorn Andersson <bjorn.andersson@linaro.org>2021-10-04 12:16:23 -0500
commit53dc3278af94a197070a2e62713cf31d04833942 (patch)
tree1f4735bdcc9941601dc3623d76e91b213b6e60e8 /parser.c
parent61da0f8fda6852d1e3e3aaeb9bebeb1338d8479c (diff)
parser: free unused message token strings
In qmi_parse(), when a message token is recognized its token structure will contain a dynamically-allocated string continaing the message name. We only use the message identifier (number) though, and as a result the message name gets leaked. Fix this by freeing the type token string if no-null. Signed-off-by: Alex Elder <elder@linaro.org> Message-Id: <20211001232338.769309-7-elder@linaro.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Diffstat (limited to 'parser.c')
-rw-r--r--parser.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/parser.c b/parser.c
index fe645f4..a1b275f 100644
--- a/parser.c
+++ b/parser.c
@@ -419,6 +419,7 @@ void qmi_parse(void)
qmi_struct_parse();
} else if (token_accept(TOK_MESSAGE, &tok)) {
qmi_message_parse(tok.num);
+ free(tok.str);
} else {
yyerror("unexpected symbol");
break;