From nobody Wed May 15 19:49:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1665141057; cv=none; d=zohomail.com; s=zohoarc; b=E375t322JgFZVeUYPFBfOVycLHrJen4gIpvbZN2Gu057ozRICtexaITocMAujiYHuyk8OSeXAmwjmtk9MJSNdlF//0ck9JPiEvAK+e0a4b2nxowVwaPjEjPdIlvorI6iwlrM2HlnKFI86FSWhVIWOGrENbZ7VVtm16hwK/vQP5k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1665141057; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=DBs8lZUygCBIK/CHSPPKPqRkQK8YKaRnEB7Awi2EsDQ=; b=cVCCDwloK7vulx9aqGE9isprHD+bbZFGXFlNAlVKF5108K4m33fSXAw2WwIB/TSz8GGlamfwn8x8IhfQDx3mRybfLsk/SHtgXwnTk0a4E2J+BNO/QNV0A25aBuT3KT26KvS5Zr08nNv2Tw8dex+LOaIdIMWomfuhdjySAagxAW8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 16651410571381009.5180333606185; Fri, 7 Oct 2022 04:10:57 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-516-Tij2EP1dM02IkC0UHT94rw-1; Fri, 07 Oct 2022 07:10:49 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 41EBE2A59558; Fri, 7 Oct 2022 11:10:47 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id C73EA40C94CE; Fri, 7 Oct 2022 11:10:44 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 75F511946A4E; Fri, 7 Oct 2022 11:10:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id A58921946A49 for ; Fri, 7 Oct 2022 11:10:42 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 5DE4A145B99C; Fri, 7 Oct 2022 11:10:42 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 03ECA1402C01 for ; Fri, 7 Oct 2022 11:10:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665141055; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=DBs8lZUygCBIK/CHSPPKPqRkQK8YKaRnEB7Awi2EsDQ=; b=YRem3XJn94+ZzvOAOIIkIR3erl4KQKtccF2wX95IIRMANXUE1m9rB944A8tWA40YiM7b1L 1fwemT9BzvayKD5zEKvoRfLq9/cI/dPCO1W4ocathAqrt3mJrkq1inwfzWMg2zjpsE+tQ/ iSyZHYhYh+6CpuoC9o/IudcWThj0VEQ= X-MC-Unique: Tij2EP1dM02IkC0UHT94rw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH] virNetServerProgramDispatchCall: Avoid calling xdr_free(_, NULL) Date: Fri, 7 Oct 2022 13:10:40 +0200 Message-Id: <236d475a8a7d00fbd8effc53f599a1f281f304af.1665141040.git.mprivozn@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1665141057734100001 Content-Type: text/plain; charset="utf-8"; x-default="true" In recent commit of v8.8.0-41-g41eb0f446c I've suggested during review to put both xdr_free() calls under error label, assuming that xdr_free() accepts NULL and thus is a NOP when the control jumps onto the label even before either of @arg or @ret was allocated. Well, turns out, xdr_free() does no accept NULL and thus we have to guard its call. But since @dispatcher is already set by the time either of the variables is allocated, we can replace the condition from 'if (dispatche)' to 'if (arg)' and 'if (ret)'. Signed-off-by: Michal Privoznik Reviewed-by: Peter Krempa --- src/rpc/virnetserverprogram.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rpc/virnetserverprogram.c b/src/rpc/virnetserverprogram.c index 212e0d5ab5..58b6a278ca 100644 --- a/src/rpc/virnetserverprogram.c +++ b/src/rpc/virnetserverprogram.c @@ -475,10 +475,10 @@ virNetServerProgramDispatchCall(virNetServerProgram *= prog, return virNetServerClientSendMessage(client, msg); =20 error: - if (dispatcher) { + if (arg) xdr_free(dispatcher->arg_filter, arg); + if (ret) xdr_free(dispatcher->ret_filter, ret); - } =20 /* Bad stuff (de-)serializing message, but we have an * RPC error message we can send back to the client */ --=20 2.35.1