fixup: wl_monitors_query returns scr->heads directly instead of making a copy (avoids leak)
This commit is contained in:
parent
c5ba4baea0
commit
3fc416a9b6
|
|
@ -596,19 +596,12 @@ wl_monitors_query(WScreen *scr, WHeadGeometry **heads_out, int *count_out)
|
|||
return;
|
||||
}
|
||||
|
||||
/* Rebuild head data from current layout */
|
||||
/* Rebuild head data from current layout.
|
||||
* The caller takes ownership of the returned head array
|
||||
* (freed on the next call to wl_screen_refresh_heads). */
|
||||
wl_screen_refresh_heads(scr);
|
||||
|
||||
if (scr->head_count == 0 || !scr->heads) {
|
||||
*heads_out = NULL;
|
||||
*count_out = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Return a copy the caller owns */
|
||||
WHeadGeometry *out = wmalloc(sizeof(WHeadGeometry) * scr->head_count);
|
||||
memcpy(out, scr->heads, sizeof(WHeadGeometry) * scr->head_count);
|
||||
*heads_out = out;
|
||||
*heads_out = scr->heads;
|
||||
*count_out = scr->head_count;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue