mirror of
https://gitlab.freedesktop.org/xorg/lib/libx11.git
synced 2026-04-22 05:50:42 +02:00
Fix XCreateIC() memory leak (Part 2)
Direct leak of 12 byte(s) in 2 object(s) allocated from:
#0 0x7f4f25c3f7a7 in strdup (/usr/lib64/libasan.so.6+0x5c7a7)
#1 0x7f4f252ce6a1 in _XimEncodeString libX11-1.8.3/modules/im/ximcp/imRm.c:818
#2 0x7f4f252ce6a1 in _XimEncodeString libX11-1.8.3/modules/im/ximcp/imRm.c:807
#3 0x7f4f252d2f0f in _XimSetICValueData libX11-1.8.3/modules/im/ximcp/imRm.c:2912
#4 0x7f4f252b536a in _XimLocalCreateIC libX11-1.8.3/modules/im/ximcp/imLcIc.c:176
#5
0x7f4f251f0105 in XCreateIC libX11-1.8.3/src/xlibi18n/ICWrap.c:251
detected and fix by Patrick Lerda <patrick9876@free.fr>
applied with adjustment, do changes when OOM (unlikely but good practise)
This commit is contained in:
parent
ed0b97e480
commit
4f78b61580
1 changed files with 19 additions and 3 deletions
|
|
@ -510,13 +510,21 @@ _XimDefaultResName(
|
|||
Xic ic = (Xic)parm;
|
||||
Xim im = (Xim)ic->core.im;
|
||||
char **out;
|
||||
|
||||
char *string;
|
||||
|
||||
if(im->core.res_name == (char *)NULL) {
|
||||
return True;
|
||||
}
|
||||
|
||||
string=strdup(im->core.res_name);
|
||||
if ( string == NULL)
|
||||
return False;
|
||||
|
||||
out = (char **)((char *)top + info->offset);
|
||||
*out = im->core.res_name;
|
||||
|
||||
Xfree(*out); /* free old im->core.res_name */
|
||||
*out =string;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
|
|
@ -529,14 +537,22 @@ _XimDefaultResClass(
|
|||
{
|
||||
Xic ic = (Xic)parm;
|
||||
Xim im = (Xim)ic->core.im;
|
||||
char *string;
|
||||
char **out;
|
||||
|
||||
if(im->core.res_class == (char *)NULL) {
|
||||
return True;
|
||||
}
|
||||
|
||||
string=strdup(im->core.res_class);
|
||||
if (string == NULL)
|
||||
return False;
|
||||
|
||||
out = (char **)((char *)top + info->offset);
|
||||
*out = im->core.res_class;
|
||||
|
||||
Xfree(*out); /* free old im->core.res_class */
|
||||
*out = string;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue