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

Re: [libvirt] [PATCH V8 5/6] make /proc/meminfo isolate with host through fuse



On Mon, Nov 12, 2012 at 03:02:27PM +0800, Gao feng wrote:
> +        len = strlen(new_line);
> +
> +        if (copied + len > size)
> +            len = size - copied;
> +
> +        memcpy(buf + copied, new_line, len);
> +        copied += len;
> +        memset(line, 0, sizeof(line));
> +        if (new_line != line)
> +            VIR_FREE(new_line);

How about using the virBuffer API here?

Also you forgot to free 'line'.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://libguestfs.org


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