From nobody Sun Feb 8 11:21:30 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1637956361; cv=none; d=zohomail.com; s=zohoarc; b=GzAMVPxqEDQnQFNwIDoqHuDJteAQaQnG/+ncwk7DDfRpT5bWUhMwknnaI388G2golSA57hZPl9yrD3tSE5nwCAXj73KulDr2mHBth/pPUjJlmMi3Jv5mBTK+nDOs+cGxdHJRZnobfZ1Qezs8JugE+nrLP8ldOGBqRbfT64sRuNE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1637956361; 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=A5nRTSj0LoJBHcNnW7y39u23Nic455Cz37fj9soUTDw=; b=Xg/T6RwoTPm99dcs9xDvByAF5CxlSuIOnD1scdshNh802XiwDmdH+ZHMTfQ+/HZn7Zm0Gwlsaq/7duob2//KQQYtBuB95iAV/YHD8Mf+beE4sZsBCLcnAWd/SHqdA7ZbLoE+iV8xmRW+ew5NQYWR008G8kz5HQo3fl8d4ZLtpis= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1637956361407850.6106995055798; Fri, 26 Nov 2021 11:52:41 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-77-Ys9OLF9vOI2plgT_edTniA-1; Fri, 26 Nov 2021 14:52:37 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1D73E81CCB5; Fri, 26 Nov 2021 19:52:32 +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 964815D9C0; Fri, 26 Nov 2021 19:52:31 +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 B2AC81809CB7; Fri, 26 Nov 2021 19:52:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AQJqPxK013317 for ; Fri, 26 Nov 2021 14:52:25 -0500 Received: by smtp.corp.redhat.com (Postfix) id D879C177C0; Fri, 26 Nov 2021 19:52:25 +0000 (UTC) Received: from rein.int.mamuti.net (unknown [10.40.192.161]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AA40C5C1CF for ; Fri, 26 Nov 2021 19:52:22 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id 88E0118008E; Fri, 26 Nov 2021 20:52:20 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637956360; 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=A5nRTSj0LoJBHcNnW7y39u23Nic455Cz37fj9soUTDw=; b=CmL5o2U5hKZkhcgz8OmpFn3DoeMEUQO/6RZZLDZeTT3DzQlqpxzPj3Iwf+lAajz44Hp4ZX 7RWZXC7OA0lsUWnO6OBiWBB2acHmYxWQuS6EA01G92VaoAkVsBARQtq/kqWmWO64/TvbJF QUXMG1saGHQNsuu02zplQ7mQqmDjSSs= X-MC-Unique: Ys9OLF9vOI2plgT_edTniA-1 From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 1/4] virthreadpool: Copy job name Date: Fri, 26 Nov 2021 20:52:16 +0100 Message-Id: <607bfbca0dcad58c4f2725f44b0fad17fb558741.1637956256.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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.14 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) X-ZM-MESSAGEID: 1637956362615100002 Content-Type: text/plain; charset="utf-8" Currently virThreadPoolNewFull relies on the caller to ensure the job name outlives the thread pool. Which basically enforces static strings. Let's drop this implicit requirement by making a copy of the job name. Signed-off-by: Jiri Denemark --- src/util/virthreadpool.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/util/virthreadpool.c b/src/util/virthreadpool.c index 7bf4333885..426840e435 100644 --- a/src/util/virthreadpool.c +++ b/src/util/virthreadpool.c @@ -50,7 +50,7 @@ struct _virThreadPool { bool quit; =20 virThreadPoolJobFunc jobFunc; - const char *jobName; + char *jobName; void *jobOpaque; virThreadPoolJobList jobList; size_t jobQueueDepth; @@ -237,7 +237,7 @@ virThreadPoolNewFull(size_t minWorkers, pool->jobList.tail =3D pool->jobList.head =3D NULL; =20 pool->jobFunc =3D func; - pool->jobName =3D name; + pool->jobName =3D g_strdup(name); pool->jobOpaque =3D opaque; =20 if (identity) @@ -312,6 +312,7 @@ void virThreadPoolFree(virThreadPool *pool) if (pool->identity) g_object_unref(pool->identity); =20 + g_free(pool->jobName); g_free(pool->workers); virMutexUnlock(&pool->mutex); virMutexDestroy(&pool->mutex); --=20 2.34.0