[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Gavin D. Smith |
Date: |
Tue, 15 Oct 2024 12:41:09 -0400 (EDT) |
branch: master
commit 0f9a216338ffc1cfa6da0eb0c721ec3f95b14f15
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Tue Oct 15 16:58:55 2024 +0100
Fix info memory leak
* info/variables.c (set_variable): Free user-entered line.
---
ChangeLog | 6 ++++++
info/variables.c | 11 ++++-------
2 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 840570e1a3..b026456b79 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2024-10-15 Gavin Smith <gavinsmith0123@gmail.com>
+
+ Fix info memory leak
+
+ * info/variables.c (set_variable): Free user-entered line.
+
2024-10-15 Gavin Smith <gavinsmith0123@gmail.com>
Always null terminate key sequence array
diff --git a/info/variables.c b/info/variables.c
index 640188d962..6fa1c31cc4 100644
--- a/info/variables.c
+++ b/info/variables.c
@@ -333,14 +333,11 @@ DECLARE_INFO_COMMAND (set_variable, _("Set the value of
an Info variable"))
return;
}
- /* User accepted default choice? If so, no change. */
- if (!*line)
- {
- free (line);
- return;
- }
+ /* User entered non-empty value? */
+ if (*line)
+ set_variable_to_value (var, line, SET_IN_SESSION);
- set_variable_to_value (var, line, SET_IN_SESSION);
+ free (line);
}
}