block: Drop superfluous conditionals around g_free()
PATCH 1/1 block: Drop superfluous conditionals around g_free()
Signed-off-by Markus Armbruster <[email protected]>
--- block/curl.c | 9 +++------ block/iscsi.c | 4 +--- hw/block/onenand.c | 4 +--- 3 files changed, 5 insertions(+), 12 deletions(-)
block/curl.c +3 -6
@@ -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);
block/iscsi.c +1 -3
@@ -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); }
hw/block/onenand.c +1 -3
@@ -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; }
Signature · 1 line
1.9.3
Quoted 6 lines · Markus Armbruster
Signed-off-by Markus Armbruster <[email protected]>--- block/curl.c | 9 +++------ block/iscsi.c | 4 +--- hw/block/onenand.c | 4 +--- 3 files changed, 5 insertions(+), 12 deletions(-)
Reviewed-by Eric Blake <[email protected]>
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Quoted 6 lines · Markus Armbruster
Signed-off-by Markus Armbruster <[email protected]>--- block/curl.c | 9 +++------ block/iscsi.c | 4 +--- hw/block/onenand.c | 4 +--- 3 files changed, 5 insertions(+), 12 deletions(-)
Reviewed-by Stefan Hajnoczi <[email protected]>
Stefan Hajnoczi
AppliedQuoted 6 lines · Markus Armbruster
Signed-off-by Markus Armbruster <[email protected]>--- block/curl.c | 9 +++------ block/iscsi.c | 4 +--- hw/block/onenand.c | 4 +--- 3 files changed, 5 insertions(+), 12 deletions(-)
Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block
Stefan