Re: [Qemu-devel] [PATCH] block: Simplify a few g_try_malloc() error checks

2015-01-27 Thread Kevin Wolf
Am 27.01.2015 um 14:42 hat Markus Armbruster geschrieben: > Paolo Bonzini writes: > > > On 27/01/2015 13:25, Markus Armbruster wrote: > >> Unlike malloc(), g_try_malloc() & friends return a null pointer only > >> on failure, never for a zero size. Simplify tests for failure > >> accordingly. Th

Re: [Qemu-devel] [PATCH] block: Simplify a few g_try_malloc() error checks

2015-01-27 Thread Markus Armbruster
Paolo Bonzini writes: > On 27/01/2015 13:25, Markus Armbruster wrote: >> Unlike malloc(), g_try_malloc() & friends return a null pointer only >> on failure, never for a zero size. Simplify tests for failure >> accordingly. This helps Coverity see returned null pointers can't be >> dereferenced.

Re: [Qemu-devel] [PATCH] block: Simplify a few g_try_malloc() error checks

2015-01-27 Thread Paolo Bonzini
On 27/01/2015 13:25, Markus Armbruster wrote: > Unlike malloc(), g_try_malloc() & friends return a null pointer only > on failure, never for a zero size. Simplify tests for failure > accordingly. This helps Coverity see returned null pointers can't be > dereferenced. Also makes the code easier

[Qemu-devel] [PATCH] block: Simplify a few g_try_malloc() error checks

2015-01-27 Thread Markus Armbruster
Unlike malloc(), g_try_malloc() & friends return a null pointer only on failure, never for a zero size. Simplify tests for failure accordingly. This helps Coverity see returned null pointers can't be dereferenced. Also makes the code easier to read. Tracked down with this Coccinelle semantic pa