[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 02/39] block: Drop superfluous conditionals around g_
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL 02/39] block: Drop superfluous conditionals around g_free() |
Date: |
Mon, 16 Jun 2014 19:23:26 +0800 |
From: Markus Armbruster <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
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 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;
}
--
1.9.3
- [Qemu-devel] [PULL 00/39] Block patches, Stefan Hajnoczi, 2014/06/16
- [Qemu-devel] [PULL 01/39] configure: Enable dead code (lzo, snappy, quorum), Stefan Hajnoczi, 2014/06/16
- [Qemu-devel] [PULL 02/39] block: Drop superfluous conditionals around g_free(),
Stefan Hajnoczi <=
- [Qemu-devel] [PULL 03/39] blockdev: Move 'serial' option to drive_init(), Stefan Hajnoczi, 2014/06/16
- [Qemu-devel] [PULL 04/39] blockdev: Rename drive_init(), drive_uninit() to drive_new(), drive_del(), Stefan Hajnoczi, 2014/06/16
- [Qemu-devel] [PULL 05/39] blockdev: Remove unused DriveInfo reference count, Stefan Hajnoczi, 2014/06/16
- [Qemu-devel] [PULL 07/39] QemuOpts: move find_desc_by_name ahead for later calling, Stefan Hajnoczi, 2014/06/16
- [Qemu-devel] [PULL 06/39] block/nfs: fix potential segfault on early callback, Stefan Hajnoczi, 2014/06/16
- [Qemu-devel] [PULL 08/39] QemuOpts: repurpose qemu_opts_print to replace print_option_parameters, Stefan Hajnoczi, 2014/06/16
- [Qemu-devel] [PULL 09/39] QemuOpts: add def_value_str to QemuOptDesc, Stefan Hajnoczi, 2014/06/16
- [Qemu-devel] [PULL 10/39] qapi: output def_value_str when query command line options, Stefan Hajnoczi, 2014/06/16
- [Qemu-devel] [PULL 11/39] QemuOpts: change opt->name|str from (const char *) to (char *), Stefan Hajnoczi, 2014/06/16
- [Qemu-devel] [PULL 12/39] QemuOpts: move qemu_opt_del ahead for later calling, Stefan Hajnoczi, 2014/06/16