[Libguestfs] [PATCH] Add echo_daemon command

Richard W.M. Jones rjones at redhat.com
Mon Sep 14 09:01:08 UTC 2009


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




More information about the Libguestfs mailing list