From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52577) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bpfkN-0002jI-9G for qemu-devel@nongnu.org; Thu, 29 Sep 2016 14:07:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bpfkJ-0008Gs-1I for qemu-devel@nongnu.org; Thu, 29 Sep 2016 14:07:50 -0400 Received: from mail-wm0-x232.google.com ([2a00:1450:400c:c09::232]:38510) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bpfkI-0008GW-RJ for qemu-devel@nongnu.org; Thu, 29 Sep 2016 14:07:46 -0400 Received: by mail-wm0-x232.google.com with SMTP id w72so42591264wmf.1 for ; Thu, 29 Sep 2016 11:07:46 -0700 (PDT) Sender: Paolo Bonzini References: <1475168226-13194-1-git-send-email-annakoppad@gmail.com> <20160929171048.GY5312@redhat.com> From: Paolo Bonzini Message-ID: Date: Thu, 29 Sep 2016 20:07:43 +0200 MIME-Version: 1.0 In-Reply-To: <20160929171048.GY5312@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] Convert uses of malloc to g_malloc List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Daniel P. Berrange" , Annapoornima Koppad Cc: qemu-devel@nongnu.org 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