From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52965) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UsSks-0005SD-1Y for qemu-devel@nongnu.org; Fri, 28 Jun 2013 03:06:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UsSkn-0007oJ-FB for qemu-devel@nongnu.org; Fri, 28 Jun 2013 03:06:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:4766) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UsSkn-0007o9-7V for qemu-devel@nongnu.org; Fri, 28 Jun 2013 03:05:57 -0400 Message-ID: <51CD35C4.5000802@redhat.com> Date: Fri, 28 Jun 2013 09:05:40 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v4 06/10] qemu-ga: Add Windows VSS provider to quiesce applications on fsfreeze List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Tomoki Sekiyama Cc: "libaiqing@huawei.com" , "mdroth@linux.vnet.ibm.com" , "stefanha@gmail.com" , "qemu-devel@nongnu.org" , "lcapitulino@redhat.com" , "vrozenfe@redhat.com" , Seiji Aguchi , Laszlo Ersek , "areis@redhat.com" Il 28/06/2013 00:25, Tomoki Sekiyama ha scritto: >>>>> >>>> +STDMETHODIMP CQGAVssProviderFactory::CreateInstance( >>>>> >>>> + IUnknown *pUnknownOuter, REFIID iid, void **ppv) >>>>> >>>> +{ >>>>> >>>> + if (pUnknownOuter) { >>>>> >>>> + return CLASS_E_NOAGGREGATION; >>>>> >>>> + } >>>>> >>>> + CQGAVssProvider *pObj = new CQGAVssProvider; >>>>> >>>> + if (!pObj) { >>>>> >>>> + return E_OUTOFMEMORY; >>>>> >>>> + } >> > >> >(We generally assume that memory allocation never fails.) > Ah, OK... Actually, we do because we use g_malloc/g_free. The functions exit on memory allocation failure. I'm not sure the same is true of the new operator... doesn't it throw an exception on allocation failure (that's what I vaguely remember)? Also, this is not running in the context of qemu-ga, so I think it is better to be more conservative and trap memory allocation failure. Paolo