From 348879493233388280a097c75f5a371512d7918b Mon Sep 17 00:00:00 2001 From: Richard Jones <rjones@redhat.com> Date: Thu, 11 Jun 2015 11:40:23 +0200 Subject: [PATCH 23/30] block: Drop superfluous conditionals around g_free() Message-id: <1434022828-13037-17-git-send-email-rjones@redhat.com> Patchwork-id: 65853 O-Subject: [RHEL-7.2 qemu-kvm v3 PATCH 16/21] block: Drop superfluous conditionals around g_free() Bugzilla: 1226684 RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com> RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com> RH-Acked-by: Laszlo Ersek <lersek@redhat.com> From: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Upstream-status: f7047c2daf760385edf83df10be4259bea190e75 Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> --- block/curl.c | 3 +-- block/iscsi.c | 4 +--- hw/block/onenand.c | 4 +--- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/block/curl.c b/block/curl.c index e48cc87..d95789a 100644 --- a/block/curl.c +++ b/block/curl.c @@ -614,8 +614,7 @@ static void curl_readv_bh_cb(void *p) acb->end = (acb->nb_sectors * SECTOR_SIZE); state->buf_off = 0; - if (state->orig_buf) - g_free(state->orig_buf); + g_free(state->orig_buf); state->buf_start = start; state->buf_len = acb->end + s->readahead_size; end = MIN(start + state->buf_len, s->len) - 1; diff --git a/block/iscsi.c b/block/iscsi.c index 2a4ab22..92dc1dd 100644 --- a/block/iscsi.c +++ b/block/iscsi.c @@ -1516,9 +1516,7 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags, out: qemu_opts_del(opts); - if (initiator_name != NULL) { - g_free(initiator_name); - } + g_free(initiator_name); if (iscsi_url != NULL) { iscsi_destroy_url(iscsi_url); } diff --git a/hw/block/onenand.c b/hw/block/onenand.c index 8b511a7..55768ec 100644 --- a/hw/block/onenand.c +++ b/hw/block/onenand.c @@ -329,9 +329,7 @@ static inline int onenand_prog_spare(OneNANDState *s, int sec, int secn, dp, 1) < 0; } } - if (dp) { - g_free(dp); - } + g_free(dp); } return result; } -- 1.8.3.1