* [Qemu-devel] [PATCH] block: Drop superfluous conditionals around g_free()
@ 2014-06-06 16:25 Markus Armbruster
2014-06-06 16:41 ` Eric Blake
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Markus Armbruster @ 2014-06-06 16:25 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf, stefanha
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] block: Drop superfluous conditionals around g_free()
2014-06-06 16:25 [Qemu-devel] [PATCH] block: Drop superfluous conditionals around g_free() Markus Armbruster
@ 2014-06-06 16:41 ` Eric Blake
2014-06-09 13:15 ` Stefan Hajnoczi
2014-06-11 9:58 ` Stefan Hajnoczi
2 siblings, 0 replies; 4+ messages in thread
From: Eric Blake @ 2014-06-06 16:41 UTC (permalink / raw)
To: Markus Armbruster, qemu-devel; +Cc: kwolf, stefanha
[-- Attachment #1: Type: text/plain, Size: 426 bytes --]
On 06/06/2014 10:25 AM, Markus Armbruster wrote:
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
> block/curl.c | 9 +++------
> block/iscsi.c | 4 +---
> hw/block/onenand.c | 4 +---
> 3 files changed, 5 insertions(+), 12 deletions(-)
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] block: Drop superfluous conditionals around g_free()
2014-06-06 16:25 [Qemu-devel] [PATCH] block: Drop superfluous conditionals around g_free() Markus Armbruster
2014-06-06 16:41 ` Eric Blake
@ 2014-06-09 13:15 ` Stefan Hajnoczi
2014-06-11 9:58 ` Stefan Hajnoczi
2 siblings, 0 replies; 4+ messages in thread
From: Stefan Hajnoczi @ 2014-06-09 13:15 UTC (permalink / raw)
To: Markus Armbruster; +Cc: kwolf, qemu-devel, stefanha
[-- Attachment #1: Type: text/plain, Size: 331 bytes --]
On Fri, Jun 06, 2014 at 06:25:12PM +0200, Markus Armbruster wrote:
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
> block/curl.c | 9 +++------
> block/iscsi.c | 4 +---
> hw/block/onenand.c | 4 +---
> 3 files changed, 5 insertions(+), 12 deletions(-)
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] block: Drop superfluous conditionals around g_free()
2014-06-06 16:25 [Qemu-devel] [PATCH] block: Drop superfluous conditionals around g_free() Markus Armbruster
2014-06-06 16:41 ` Eric Blake
2014-06-09 13:15 ` Stefan Hajnoczi
@ 2014-06-11 9:58 ` Stefan Hajnoczi
2 siblings, 0 replies; 4+ messages in thread
From: Stefan Hajnoczi @ 2014-06-11 9:58 UTC (permalink / raw)
To: Markus Armbruster; +Cc: kwolf, qemu-devel
[-- Attachment #1: Type: text/plain, Size: 369 bytes --]
On Fri, Jun 06, 2014 at 06:25:12PM +0200, Markus Armbruster wrote:
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
> 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
[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-06-11 9:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-06 16:25 [Qemu-devel] [PATCH] block: Drop superfluous conditionals around g_free() Markus Armbruster
2014-06-06 16:41 ` Eric Blake
2014-06-09 13:15 ` Stefan Hajnoczi
2014-06-11 9:58 ` Stefan Hajnoczi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).