On 09/13/2013 04:25 AM, Peter Lieven wrote:
> Signed-off-by: Peter Lieven <p...@kamp.de>
> ---
>  block/iscsi.c |   78 
> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 78 insertions(+)
> 

> +    if (iscsilun->zeroblock == NULL) {
> +        iscsilun->zeroblock = g_malloc(iscsilun->block_size);
> +        if (iscsilun->zeroblock == NULL) {
> +            return -ENOMEM;

g_malloc cannot return NULL (it aborts the program on OOM instead), so
this is dead code.

> +        }
> +        memset(iscsilun->zeroblock, 0x00, iscsilun->block_size);

Furthermore, if you had used g_malloc0(), you wouldn't need this memset.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to