mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2025-12-26 22:48:19 +00:00
worker: do not use dynamic memory for RedSurfaceCmd
Allocation on stack is sufficient and code is more similar to QXL_CMD_MESSAGE and QXL_CMD_UPDATE cases. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
This commit is contained in:
parent
c1ecbaf7b1
commit
768dfa2139
@ -2078,7 +2078,7 @@ void display_channel_process_surface_cmd(DisplayChannel *display, RedSurfaceCmd
|
||||
|
||||
surface_id = surface->surface_id;
|
||||
if SPICE_UNLIKELY(surface_id >= display->n_surfaces) {
|
||||
goto exit;
|
||||
return;
|
||||
}
|
||||
|
||||
red_surface = &display->surfaces[surface_id];
|
||||
@ -2116,9 +2116,6 @@ void display_channel_process_surface_cmd(DisplayChannel *display, RedSurfaceCmd
|
||||
default:
|
||||
spice_warn_if_reached();
|
||||
};
|
||||
exit:
|
||||
red_put_surface_cmd(surface);
|
||||
free(surface);
|
||||
}
|
||||
|
||||
void display_channel_update_compression(DisplayChannel *display, DisplayChannelClient *dcc)
|
||||
|
||||
@ -329,15 +329,16 @@ static int red_process_commands(RedWorker *worker, uint32_t max_pipe_size, int *
|
||||
break;
|
||||
}
|
||||
case QXL_CMD_SURFACE: {
|
||||
RedSurfaceCmd *surface = spice_new0(RedSurfaceCmd, 1);
|
||||
RedSurfaceCmd surface;
|
||||
|
||||
if (red_get_surface_cmd(&worker->mem_slots, ext_cmd.group_id,
|
||||
surface, ext_cmd.cmd.data)) {
|
||||
free(surface);
|
||||
&surface, ext_cmd.cmd.data)) {
|
||||
break;
|
||||
}
|
||||
display_channel_process_surface_cmd(worker->display_channel, surface,
|
||||
display_channel_process_surface_cmd(worker->display_channel, &surface,
|
||||
ext_cmd.group_id, FALSE);
|
||||
// do not release resource as is released inside red_process_surface
|
||||
red_put_surface_cmd(&surface);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user