diff options
author | Keith Packard <keithp@keithp.com> | 2020-11-17 15:18:46 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2020-11-17 15:18:46 -0800 |
commit | 706ed45e0b58219bc623b8c5f963777a120d2844 (patch) | |
tree | d565f8d079e554be71956f0a46b20d57ecc8a04c | |
parent | a30ed360fe56a556072e1fc551ffbe6797642227 (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.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -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; |