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>
This commit is contained in:
Markus Armbruster 2014-06-06 18:25:12 +02:00 committed by Stefan Hajnoczi
parent b25c9dff35
commit f7047c2daf
3 changed files with 5 additions and 12 deletions

View file

@ -440,11 +440,9 @@ static void curl_detach_aio_context(BlockDriverState *bs)
curl_easy_cleanup(s->states[i].curl); curl_easy_cleanup(s->states[i].curl);
s->states[i].curl = NULL; s->states[i].curl = NULL;
} }
if (s->states[i].orig_buf) {
g_free(s->states[i].orig_buf); g_free(s->states[i].orig_buf);
s->states[i].orig_buf = NULL; s->states[i].orig_buf = NULL;
} }
}
if (s->multi) { if (s->multi) {
curl_multi_cleanup(s->multi); curl_multi_cleanup(s->multi);
s->multi = NULL; s->multi = NULL;
@ -638,7 +636,6 @@ static void curl_readv_bh_cb(void *p)
acb->end = (acb->nb_sectors * SECTOR_SIZE); acb->end = (acb->nb_sectors * SECTOR_SIZE);
state->buf_off = 0; state->buf_off = 0;
if (state->orig_buf)
g_free(state->orig_buf); g_free(state->orig_buf);
state->buf_start = start; state->buf_start = start;
state->buf_len = acb->end + s->readahead_size; state->buf_len = acb->end + s->readahead_size;

View file

@ -1434,9 +1434,7 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags,
out: out:
qemu_opts_del(opts); qemu_opts_del(opts);
if (initiator_name != NULL) {
g_free(initiator_name); g_free(initiator_name);
}
if (iscsi_url != NULL) { if (iscsi_url != NULL) {
iscsi_destroy_url(iscsi_url); iscsi_destroy_url(iscsi_url);
} }

View file

@ -335,10 +335,8 @@ static inline int onenand_prog_spare(OneNANDState *s, int sec, int secn,
dp, 1) < 0; dp, 1) < 0;
} }
} }
if (dp) {
g_free(dp); g_free(dp);
} }
}
return result; return result;
} }