From nobody Mon Feb 9 05:01:18 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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=1594151217; cv=none; d=zohomail.com; s=zohoarc; b=TrZVgLqMBlYTvcMtJVBsPmqvmu0Rr0Q6uTnmyTmLRfzVuBOSdr4jWNBsa5Hb6cXUUYtFXWaMaZpJM1n6VGeMOIr21tcGu09Kuc9YgRwQZPuL5xhSGK930h/88KRGZPEyVku2T3vNTZVMsKMa+2lNgP+gf0QZzyXTsXh7I1vQCBM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594151217; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=xgyUIRefyN17Yh/z7nev86Cq63kZFYfIvxJlh4ibVLQ=; b=JTt0zipA9yJeD4zP9KzizeRpNL2kuqETiRNosm06iG7vLV2HeBue34di3CWzKEn4OTxPABsKfE8Wp0JtrUtbdSVqrx4NalausECASl+HxhoUIO8W81lOaeStMQUei8uCCLgK7uuEvLrvlp2td/tEuhjJWJHZffCNlgs0lhn96Cg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1594151217702513.7981703427848; Tue, 7 Jul 2020 12:46:57 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-323-lEL5BToyODuwju37BQxqkw-1; Tue, 07 Jul 2020 15:46:54 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 129E8EC1A6; Tue, 7 Jul 2020 19:46:47 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E10BD5C1D0; Tue, 7 Jul 2020 19:46:45 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 4E570180954D; Tue, 7 Jul 2020 19:46:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 067JkgAc031421 for ; Tue, 7 Jul 2020 15:46:42 -0400 Received: by smtp.corp.redhat.com (Postfix) id 23B0E797F0; Tue, 7 Jul 2020 19:46:42 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.192.152]) by smtp.corp.redhat.com (Postfix) with ESMTP id 97887797EF for ; Tue, 7 Jul 2020 19:46:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594151216; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=xgyUIRefyN17Yh/z7nev86Cq63kZFYfIvxJlh4ibVLQ=; b=T7dta4hAe/BxEejlKa5qPffCptPBiDv39TR6pZTpuy3nRZIbqLs2cd0jesRAKg+nAbYgPn B6uaOup3yZD2tZ6C+Y5pAKXK6I8c8dmyRcmVD9KuiOEZpA66ZCmFeK72C5fOA+mgg9kTC4 olrK/capIULnOurhnzQrLXz84Qbc8Y8= X-MC-Unique: lEL5BToyODuwju37BQxqkw-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH v2 02/17] virFDStreamMsgQueuePush: Clear pointer to passed message Date: Tue, 7 Jul 2020 21:46:20 +0200 Message-Id: <521b0da7014c53ed98574882abaa415298502ca2.1594150891.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" All callers of virFDStreamMsgQueuePush() have the same pattern: they explicitly set @msg passed to NULL to avoid freeing it later on. Well, the function can take address of the pointer and clear it for them. Signed-off-by: Michal Privoznik Reviewed-by: Peter Krempa =20 --- src/util/virfdstream.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/util/virfdstream.c b/src/util/virfdstream.c index e29c95690b..6efe6c17ad 100644 --- a/src/util/virfdstream.c +++ b/src/util/virfdstream.c @@ -140,7 +140,7 @@ VIR_ONCE_GLOBAL_INIT(virFDStreamData); =20 static int virFDStreamMsgQueuePush(virFDStreamDataPtr fdst, - virFDStreamMsgPtr msg, + virFDStreamMsgPtr *msg, int fd, const char *fdname) { @@ -150,7 +150,7 @@ virFDStreamMsgQueuePush(virFDStreamDataPtr fdst, while (*tmp) tmp =3D &(*tmp)->next; =20 - *tmp =3D msg; + *tmp =3D g_steal_pointer(msg); virCondSignal(&fdst->threadCond); =20 if (safewrite(fd, &c, sizeof(c)) !=3D sizeof(c)) { @@ -489,8 +489,7 @@ virFDStreamThreadDoRead(virFDStreamDataPtr fdst, *dataLen -=3D got; } =20 - virFDStreamMsgQueuePush(fdst, msg, fdout, fdoutname); - msg =3D NULL; + virFDStreamMsgQueuePush(fdst, &msg, fdout, fdoutname); =20 return got; =20 @@ -814,8 +813,7 @@ static int virFDStreamWrite(virStreamPtr st, const char= *bytes, size_t nbytes) msg->stream.data.buf =3D buf; msg->stream.data.len =3D nbytes; =20 - virFDStreamMsgQueuePush(fdst, msg, fdst->fd, "pipe"); - msg =3D NULL; + virFDStreamMsgQueuePush(fdst, &msg, fdst->fd, "pipe"); ret =3D nbytes; } else { retry: @@ -1010,8 +1008,7 @@ virFDStreamSendHole(virStreamPtr st, =20 msg->type =3D VIR_FDSTREAM_MSG_TYPE_HOLE; msg->stream.hole.len =3D length; - virFDStreamMsgQueuePush(fdst, msg, fdst->fd, "pipe"); - msg =3D NULL; + virFDStreamMsgQueuePush(fdst, &msg, fdst->fd, "pipe"); } } else { off =3D lseek(fdst->fd, length, SEEK_CUR); --=20 2.26.2