From: Christophe CURIS <christophe.cu...@free.fr> As pointed by Coverity, the array created to temporary store the list of Atoms used in the function 'requestHandler' was leaked.
Because this array is very short lived, there is no need to allocate memory for this, it just participates in memory fragmentation. Instead, we use now memory on the stack which is more efficient. Signed-off-by: Christophe CURIS <christophe.cu...@free.fr> --- WINGs/wtext.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/WINGs/wtext.c b/WINGs/wtext.c index 5981de3..93090e4 100644 --- a/WINGs/wtext.c +++ b/WINGs/wtext.c @@ -2061,15 +2061,14 @@ static WMData *requestHandler(WMView * view, Atom selection, Atom target, void * _TARGETS = XInternAtom(dpy, "TARGETS", False); if (target == _TARGETS) { - Atom *ptr; + Atom array[4]; - ptr = wmalloc(4 * sizeof(Atom)); - ptr[0] = _TARGETS; - ptr[1] = XA_STRING; - ptr[2] = TEXT; - ptr[3] = COMPOUND_TEXT; + array[0] = _TARGETS; + array[1] = XA_STRING; + array[2] = TEXT; + array[3] = COMPOUND_TEXT; - data = WMCreateDataWithBytes(ptr, 4 * 4); + data = WMCreateDataWithBytes(&array, sizeof(array)); WMSetDataFormat(data, 32); *type = target; -- 2.1.1 -- To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.