Re: [PATCH 04/22] worker: do not use dynamic memory for RedSurfaceCmd

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 
> On Wed, Dec 2, 2015 at 5:19 PM, Frediano Ziglio <fziglio@xxxxxxxxxx> wrote:
> > 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@xxxxxxxxxx>
> > ---
> >  server/display-channel.c | 5 +----
> >  server/red_worker.c      | 9 +++++----
> >  2 files changed, 6 insertions(+), 8 deletions(-)
> >
> > diff --git a/server/display-channel.c b/server/display-channel.c
> > index 43f2e0e..809673b 100644
> > --- a/server/display-channel.c
> > +++ b/server/display-channel.c
> > @@ -2081,7 +2081,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];
> > @@ -2119,9 +2119,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)
> > diff --git a/server/red_worker.c b/server/red_worker.c
> > index 329c2ef..f2c3126 100644
> > --- a/server/red_worker.c
> > +++ b/server/red_worker.c
> > @@ -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:
> > --
> > 2.4.3
> >
> > _______________________________________________
> > Spice-devel mailing list
> > Spice-devel@xxxxxxxxxxxxxxxxxxxxx
> > http://lists.freedesktop.org/mailman/listinfo/spice-devel
> 
> Acked-by: Fabiano Fidêncio <fidencio@xxxxxxxxxx>
> 

Merged

Frediano
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]