Skip to content

Commit 45db4a5

Browse files
Fix possible use after free
1 parent caf976b commit 45db4a5

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/detection/displayserver/xcb.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -213,15 +213,15 @@ static bool xcbRandrHandleCrtc(XcbRandrData* data, xcb_randr_crtc_t crtc)
213213
return false;
214214

215215
bool res = xcbRandrHandleMode(data, crtcInfoReply->mode);
216-
217-
free(crtcInfoReply);
218-
219-
return res ? true : ffdsAppendResolution(
216+
res = res ? true : ffdsAppendResolution(
220217
data->result,
221218
(uint32_t) crtcInfoReply->width,
222219
(uint32_t) crtcInfoReply->height,
223220
data->defaultRefreshRate
224221
);
222+
223+
free(crtcInfoReply);
224+
return res;
225225
}
226226

227227
static bool xcbRandrHandleOutput(XcbRandrData* data, xcb_randr_output_t output)

src/detection/displayserver/xlib.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,15 +161,15 @@ static bool xrandrHandleCrtc(XrandrData* data, RRCrtc crtc)
161161
return false;
162162

163163
bool res = xrandrHandleMode(data, crtcInfo->mode);
164-
165-
data->ffXRRFreeCrtcInfo(crtcInfo);
166-
167-
return res ? true : ffdsAppendResolution(
164+
res = res ? true : ffdsAppendResolution(
168165
data->result,
169166
(uint32_t) crtcInfo->width,
170167
(uint32_t) crtcInfo->height,
171168
data->defaultRefreshRate
172169
);
170+
171+
data->ffXRRFreeCrtcInfo(crtcInfo);
172+
return res;
173173
}
174174

175175
static bool xrandrHandleOutput(XrandrData* data, RROutput output)

0 commit comments

Comments
 (0)