summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2020-11-17 15:18:46 -0800
committerKeith Packard <keithp@keithp.com>2020-11-17 15:18:46 -0800
commit706ed45e0b58219bc623b8c5f963777a120d2844 (patch)
treed565f8d079e554be71956f0a46b20d57ecc8a04c
parenta30ed360fe56a556072e1fc551ffbe6797642227 (diff)
Free string list returned from XmbTextPropertyToTextList
Make sure we clean up after this call by using the XFreeStringList function. Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--xprop.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/xprop.c b/xprop.c
index 55feaab..f220604 100644
--- a/xprop.c
+++ b/xprop.c
@@ -894,7 +894,7 @@ static const char *
Format_Len_Text (const char *string, int len, Atom encoding)
{
XTextProperty textprop;
- char **list;
+ char **list, **start_list;
int count;
/* Try to convert to local encoding. */
@@ -902,7 +902,8 @@ Format_Len_Text (const char *string, int len, Atom encoding)
textprop.format = 8;
textprop.value = (unsigned char *) string;
textprop.nitems = len;
- if (XmbTextPropertyToTextList(dpy, &textprop, &list, &count) == Success) {
+ if (XmbTextPropertyToTextList(dpy, &textprop, &start_list, &count) == Success) {
+ list = start_list;
_buf_ptr = _formatting_buffer;
_buf_len = MAXSTR;
*_buf_ptr++ = '"';
@@ -936,6 +937,7 @@ Format_Len_Text (const char *string, int len, Atom encoding)
_buf_len -= 4;
}
}
+ XFreeStringList(start_list);
*_buf_ptr++ = '"';
*_buf_ptr++ = '\0';
return _formatting_buffer;