[Spice-devel] [PATCH] replay: use spice_malloc0 instead of raw malloc
Frediano Ziglio
fziglio at redhat.com
Fri Jan 15 02:20:31 PST 2016
>
> On Fri, Jan 15, 2016 at 11:02 AM, Victor Toso <lists at victortoso.com> wrote:
> > Hi,
> >
> > On Fri, Jan 15, 2016 at 09:51:58AM +0000, Frediano Ziglio wrote:
> >> This function report memory allocation errors and reset memory
> >> after allocation.
> >>
> >> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> >> ---
> >> server/red-replay-qxl.c | 2 +-
> >
> > It seems that there are other places that could use spice_malloc in
> > red-replay-qxl, no?
>
> And why not g_malloc0() instead of spice_malloc0()?
>
Because would require to replace properly free with g_free
Frediano
> >
> > Patch looks good
> > Reviewed-by: Victor Toso <victortoso at redhat.com>
> >
> >> 1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/server/red-replay-qxl.c b/server/red-replay-qxl.c
> >> index 8e0b28c..fb7b9b7 100644
> >> --- a/server/red-replay-qxl.c
> >> +++ b/server/red-replay-qxl.c
> >> @@ -1215,7 +1215,7 @@ SpiceReplay *spice_replay_new(FILE *file, int
> >> nsurfaces)
> >> }
> >> }
> >>
> >> - replay = malloc(sizeof(SpiceReplay));
> >> + replay = spice_malloc0(sizeof(SpiceReplay));
> >>
> >> replay->eof = 0;
> >> replay->fd = file;
> >> --
> >> 2.4.3
> >>
More information about the Spice-devel
mailing list