On Thu, Jun 11, 2015 at 04:52:09PM +0200, Christophe Fergeau wrote:
> On Wed, Jun 10, 2015 at 02:53:05PM +0100, Frediano Ziglio wrote:
> > Do not just check and give warning before crashing the program
> > accessing a NULL pointer but use spice_malloc which exits with a
> > proper message.
> > 
> > Signed-off-by: Frediano Ziglio <[email protected]>
> > ---
> >  server/red_worker.c | 6 ++----
> >  1 file changed, 2 insertions(+), 4 deletions(-)
> > 
> > Change from v1:
> > - fix type in patch comment
> > 
> > diff --git a/server/red_worker.c b/server/red_worker.c
> > index 1871e13..03d07e2 100644
> > --- a/server/red_worker.c
> > +++ b/server/red_worker.c
> > @@ -1664,8 +1664,7 @@ static SurfaceDestroyItem 
> > *get_surface_destroy_item(RedChannel *channel,
> >  {
> >      SurfaceDestroyItem *destroy;
> >  
> > -    destroy = (SurfaceDestroyItem *)malloc(sizeof(SurfaceDestroyItem));
> > -    spice_warn_if(!destroy);
> > +    destroy = (SurfaceDestroyItem 
> > *)spice_malloc(sizeof(SurfaceDestroyItem));
> >  
> >      destroy->surface_destroy.surface_id = surface_id;
> >  
> > @@ -9399,8 +9398,7 @@ static SurfaceCreateItem *get_surface_create_item(
> >  {
> >      SurfaceCreateItem *create;
> >  
> > -    create = (SurfaceCreateItem *)malloc(sizeof(SurfaceCreateItem));
> > -    spice_warn_if(!create);
> > +    create = (SurfaceCreateItem *)spice_malloc(sizeof(SurfaceCreateItem));
> 
> Actually the cast is unnecessary, I'll drop it too (I've already made the
> change locally, no need to resend a v3 for that).

I've now pushed this.

Christophe

Attachment: pgpqflL8M4lYT.pgp
Description: PGP signature

_______________________________________________
Spice-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/spice-devel

Reply via email to