1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-23 06:38:05 +01:00

WINGs: fix memory leak in requestHandler (Coverity #50136)

As pointed by Coverity, the allocated temporary storage was not freed. As
an allocation is not needed here, replaced by a local storage.
This commit is contained in:
Christophe CURIS
2014-05-18 21:31:47 +02:00
committed by Carlos R. Mafra
parent 482d8d3583
commit 354ec080ad

View File

@@ -262,15 +262,14 @@ static WMData *requestHandler(WMView * view, Atom selection, Atom target, void *
_TARGETS = XInternAtom(dpy, "TARGETS", False); _TARGETS = XInternAtom(dpy, "TARGETS", False);
if (target == _TARGETS) { if (target == _TARGETS) {
Atom *ptr; Atom supported_type[4];
ptr = wmalloc(4 * sizeof(Atom)); supported_type[0] = _TARGETS;
ptr[0] = _TARGETS; supported_type[1] = XA_STRING;
ptr[1] = XA_STRING; supported_type[2] = TEXT;
ptr[2] = TEXT; supported_type[3] = COMPOUND_TEXT;
ptr[3] = COMPOUND_TEXT;
data = WMCreateDataWithBytes(ptr, 4 * 4); data = WMCreateDataWithBytes(supported_type, sizeof(supported_type));
WMSetDataFormat(data, 32); WMSetDataFormat(data, 32);
*type = target; *type = target;