aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2014-06-06 18:25:12 +0200
committerStefan Hajnoczi <stefanha@redhat.com>2014-06-16 17:23:19 +0800
commitf7047c2daf760385edf83df10be4259bea190e75 (patch)
treea84a3315f0b8d6f393037032da42b78beccb47b3
parentb25c9dff3599892a16f824b5df643e0fc1acbfc1 (diff)
downloadqemu-f7047c2daf760385edf83df10be4259bea190e75.zip
qemu-f7047c2daf760385edf83df10be4259bea190e75.tar.gz
qemu-f7047c2daf760385edf83df10be4259bea190e75.tar.bz2
block: Drop superfluous conditionals around g_free()
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>
-rw-r--r--block/curl.c9
-rw-r--r--block/iscsi.c4
-rw-r--r--hw/block/onenand.c4
3 files changed, 5 insertions, 12 deletions
diff --git a/block/curl.c b/block/curl.c
index 8c84141..79ff2f1 100644
--- a/block/curl.c
+++ b/block/curl.c
@@ -440,10 +440,8 @@ static void curl_detach_aio_context(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);
@@ -638,8 +636,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 877b877..38bfdb6 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -1434,9 +1434,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;
}