From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52512) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WswxJ-0001Tq-4O for qemu-devel@nongnu.org; Fri, 06 Jun 2014 12:25:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WswxD-0008FU-0f for qemu-devel@nongnu.org; Fri, 06 Jun 2014 12:25:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39392) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WswxC-0008F0-H0 for qemu-devel@nongnu.org; Fri, 06 Jun 2014 12:25:18 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s56GPH7T031672 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 6 Jun 2014 12:25:17 -0400 From: Markus Armbruster Date: Fri, 6 Jun 2014 18:25:12 +0200 Message-Id: <1402071912-17924-1-git-send-email-armbru@redhat.com> Subject: [Qemu-devel] [PATCH] block: Drop superfluous conditionals around g_free() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, stefanha@redhat.com Signed-off-by: Markus Armbruster --- block/curl.c | 9 +++------ block/iscsi.c | 4 +--- hw/block/onenand.c | 4 +--- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/block/curl.c b/block/curl.c index f491b0b..6498fd6 100644 --- a/block/curl.c +++ b/block/curl.c @@ -599,8 +599,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; @@ -648,10 +647,8 @@ static void curl_close(BlockDriverState *bs) curl_easy_cleanup(s->states[i].curl); s->states[i].curl = NULL; } - if (s->states[i].orig_buf) { - g_free(s->states[i].orig_buf); - s->states[i].orig_buf = NULL; - } + g_free(s->states[i].orig_buf); + s->states[i].orig_buf = NULL; } if (s->multi) curl_multi_cleanup(s->multi); diff --git a/block/iscsi.c b/block/iscsi.c index 3892cc5..865b338 100644 --- a/block/iscsi.c +++ b/block/iscsi.c @@ -1398,9 +1398,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 60d5311..5388122 100644 --- a/hw/block/onenand.c +++ b/hw/block/onenand.c @@ -335,9 +335,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.9.3