From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34778) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZoSgj-0006Cy-5D for qemu-devel@nongnu.org; Tue, 20 Oct 2015 04:54:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZoSga-0004YA-R5 for qemu-devel@nongnu.org; Tue, 20 Oct 2015 04:54:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43699) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZoSga-0004Xz-LQ for qemu-devel@nongnu.org; Tue, 20 Oct 2015 04:54:24 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id B701591E8F for ; Tue, 20 Oct 2015 08:54:23 +0000 (UTC) Message-ID: <1445331261.13733.65.camel@redhat.com> From: Gerd Hoffmann Date: Tue, 20 Oct 2015 10:54:21 +0200 In-Reply-To: <87h9lmat1b.fsf@blackfin.pond.sub.org> References: <1444968943-11254-1-git-send-email-eblake@redhat.com> <1444968943-11254-5-git-send-email-eblake@redhat.com> <87h9lmat1b.fsf@blackfin.pond.sub.org> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v9 04/17] vnc: hoist allocation of VncBasicInfo to callers List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: qemu-devel@nongnu.org Hi, > > -static VncBasicInfo *vnc_basic_info_get(struct sockaddr_storage *sa, > > - socklen_t salen) > > +static void vnc_basic_info_get(struct sockaddr_storage *sa, > > + socklen_t salen, > > + VncBasicInfo *info, > > + Error **errp) > The function no longer "gets info", it merely initializes it. Rename it > accordingly? Gerd? vnc_fill_basic_info maybe? > Outside this patch's scope, but since I'm looking at the code already... > > Here's the only caller of vnc_server_info_get(): > > static void vnc_qmp_event(VncState *vs, QAPIEvent event) > { > VncServerInfo *si; > > if (!vs->info) { > return; > } > g_assert(vs->info->base); > > si = vnc_server_info_get(vs->vd); > if (!si) { > ---> return; > } > > switch (event) { > case QAPI_EVENT_VNC_CONNECTED: > qapi_event_send_vnc_connected(si, vs->info->base, &error_abort); > break; > case QAPI_EVENT_VNC_INITIALIZED: > qapi_event_send_vnc_initialized(si, vs->info, &error_abort); > break; > case QAPI_EVENT_VNC_DISCONNECTED: > qapi_event_send_vnc_disconnected(si, vs->info, &error_abort); > break; > default: > break; > } > > qapi_free_VncServerInfo(si); > } > > When vnc_server_info_get() fails, the event is dropped. Why is that > okay? Failure seems unlikely, though. Suggestions what else to do? I don't wanna crash qemu by calling qapi_event_send_vnc_* with a NULL pointer. And, yes, it should be highly unlikely so trying some more sophisticated error handling would probably be dead code ... cheers, Gerd