[Libguestfs] [PATCH] Add echo_daemon command

Matthew Booth mbooth at redhat.com
Mon Sep 14 09:06:23 UTC 2009


On 14/09/09 10:01, Richard W.M. Jones wrote:
> 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.

That's what I get for shooting from the hip :) New patch to follow.

Matt

-- 
Matthew Booth, RHCA, RHCSS
Red Hat Engineering, Virtualisation Team

M:       +44 (0)7977 267231
GPG ID:  D33C3490
GPG FPR: 3733 612D 2D05 5458 8A8A 1600 3441 EA19 D33C 3490




More information about the Libguestfs mailing list