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

Re: [Libguestfs] [PATCH] Add echo_daemon command



On Mon, Sep 14, 2009 at 09:48:43AM +0100, Matthew Booth wrote:
> +    /* Make the output buffer big enough for the string and its terminator */
> +    char *out_new = realloc (out, out_len + 1);
> +    if (NULL == out_new) {
> +      reply_with_perror ("realloc");
> +      return 0;
> +    }
> +    out = out_new;

No this is still wrong.  It should call "free (out);" on the error path.

Garbage collection FTW.

Rich.

-- 
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://et.redhat.com/~rjones/virt-top


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