[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: [fedora-virt] [PATCH libguestfs] use xmalloc and xcalloc in generated code
- From: "Richard W.M. Jones" <rjones redhat com>
- To: Jim Meyering <jim meyering net>
- Cc: Fedora Virtualization List <fedora-virt redhat com>
- Subject: Re: [fedora-virt] [PATCH libguestfs] use xmalloc and xcalloc in generated code
- Date: Thu, 2 Jul 2009 22:21:23 +0100
On Thu, Jul 02, 2009 at 11:16:37PM +0200, Jim Meyering wrote:
> Hi Rich,
>
> I noticed that there were some unchecked malloc and calloc return values.
> That could result in NULL deref upon failed allocation. Based on what
> you said about there not being much point in trying to recover from OOM
> errors, I made the small textual change to convert e.g., malloc(n) to
> xmalloc(g,n) where xmalloc now ends up calling g->abort_cb upon malloc
> failure. Then any following dereference of the result is guaranteed to
> be valid.
I think the patch is fine, but I generally wonder why we now have
functions which do the same thing called xmalloc and
[guestfs_]safe_malloc?
Rich.
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]