Skip to content

Commit

Permalink
scsi: Drop superfluous conditionals around g_free()
Browse files Browse the repository at this point in the history
Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Reviewed-by: Fam Zheng <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
  • Loading branch information
Markus Armbruster authored and bonzini committed Dec 15, 2014
1 parent e42a92a commit 1c3381a
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions hw/scsi/scsi-generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,7 @@ static int32_t scsi_send_command(SCSIRequest *req, uint8_t *cmd)
#endif

if (r->req.cmd.xfer == 0) {
if (r->buf != NULL)
g_free(r->buf);
g_free(r->buf);
r->buflen = 0;
r->buf = NULL;
/* The request is used as the AIO opaque value, so add a ref. */
Expand All @@ -314,8 +313,7 @@ static int32_t scsi_send_command(SCSIRequest *req, uint8_t *cmd)
}

if (r->buflen != r->req.cmd.xfer) {
if (r->buf != NULL)
g_free(r->buf);
g_free(r->buf);
r->buf = g_malloc(r->req.cmd.xfer);
r->buflen = r->req.cmd.xfer;
}
Expand Down

0 comments on commit 1c3381a

Please sign in to comment.