From 706ed45e0b58219bc623b8c5f963777a120d2844 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 17 Nov 2020 15:18:46 -0800 Subject: Free string list returned from XmbTextPropertyToTextList Make sure we clean up after this call by using the XFreeStringList function. Signed-off-by: Keith Packard --- xprop.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'xprop.c') 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; -- cgit v1.2.3