From: Paolo Bonzini <pbonzini@redhat.com>
To: "Daniel P. Berrange" <berrange@redhat.com>,
Annapoornima Koppad <annakoppad@gmail.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] Convert uses of malloc to g_malloc
Date: Thu, 29 Sep 2016 20:07:43 +0200 [thread overview]
Message-ID: <af87bcfb-f4d3-d4d8-ffea-ef099b5335d3@redhat.com> (raw)
In-Reply-To: <20160929171048.GY5312@redhat.com>
On 29/09/2016 19:10, Daniel P. Berrange wrote:
>> >
>> > - acb->task = malloc(sizeof(struct scsi_task));
>> > + acb->task = g_malloc(sizeof(struct scsi_task));
>> > if (acb->task == NULL) {
>> > error_report("iSCSI: Failed to allocate task for scsi command. %s",
>> > iscsi_get_error(iscsi));
> For every malloc you convert to g_malloc, you must also
> convert the corresponding 'free' to 'g_free'. This seems
> missing throughout your patch.
Also realloc -> g_realloc when that applies. Finally, checks for
allocation errors should be removed after g_malloc (or g_new).
Paolo
next prev parent reply other threads:[~2016-09-29 18:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-29 16:57 [Qemu-devel] [PATCH] Convert uses of malloc to g_malloc Annapoornima Koppad
2016-09-29 17:10 ` Daniel P. Berrange
2016-09-29 18:07 ` Paolo Bonzini [this message]
2016-09-29 17:15 ` no-reply
2016-09-29 17:16 ` no-reply
2016-09-29 17:24 ` Thomas Huth
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=af87bcfb-f4d3-d4d8-ffea-ef099b5335d3@redhat.com \
--to=pbonzini@redhat.com \
--cc=annakoppad@gmail.com \
--cc=berrange@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).