From nobody Mon Feb 9 11:46:55 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; 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 205.139.110.61 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=1599824563; cv=none; d=zohomail.com; s=zohoarc; b=gDYD/+qrXM3/FQRAMZe/F5XG38wLA4o/nPOr4WdvUZS9sVF32DeXi++VOCe44l7r1lDPNTt3L5n2Oc01NIH+SY7whASCfbmdX0tpyFcRCBAqbmYevHBkwF3fD+OVgrU35tMeU5F48rfEzF5k6Z/x2D1iBDnYJ7NpVamZDY8ouE0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599824563; h=Content-Type:Content-Transfer-Encoding:Cc: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=2GQ5JySE0sZNxzdxu21IVj4H9zmGgviK08GGHYlne+E=; b=BKkL80JFw1hNGP8hJ414tZE/SeuuXEHYuTO3uflZfRrPkXLt2wUt37J3pJbspnmLBRjjypnNTtqsKnLWio3QmdIWIVOSyo8Q8GFkFyxXgKE5EnFmDpBC90KPLdc2c+3GKi5XofZsPevObMIMOHWwtDF4oAEyCeuDDQo+E758rCk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1599824563837899.3180798189874; Fri, 11 Sep 2020 04:42:43 -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-576-uFrnzdGbOWq0HCrdm3g7TQ-1; Fri, 11 Sep 2020 07:42:40 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8E58681CBEB; Fri, 11 Sep 2020 11:42:33 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6C39375127; Fri, 11 Sep 2020 11:42:33 +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 348DC92306; Fri, 11 Sep 2020 11:42:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 08BBgUSw010656 for ; Fri, 11 Sep 2020 07:42:30 -0400 Received: by smtp.corp.redhat.com (Postfix) id 954B75D9F7; Fri, 11 Sep 2020 11:42:30 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-112-163.ams2.redhat.com [10.36.112.163]) by smtp.corp.redhat.com (Postfix) with ESMTP id DE5325D9E8; Fri, 11 Sep 2020 11:42:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599824562; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=2GQ5JySE0sZNxzdxu21IVj4H9zmGgviK08GGHYlne+E=; b=d/Atg22OCIwsMN9oVnbL6RhVxnF4ZWpYG3ErsWAftKLNgUIGTJYgZL1kY2tIYSzJv1C7LX A8pqb+akn0wS2Poazxi3Zb8FW70ZnKcZPGnZN1D+IwoWU30nJ4k5izTw9bpqJB8d21BqR1 Po56JauI4kfnUvRMkCUi2Y6upc73yh4= X-MC-Unique: uFrnzdGbOWq0HCrdm3g7TQ-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 07/21] util: Use glib memory functions in virLogFilterNew Date: Fri, 11 Sep 2020 13:42:04 +0200 Message-Id: <20200911114218.489636-8-twiederh@redhat.com> In-Reply-To: <20200911114218.489636-1-twiederh@redhat.com> References: <20200911114218.489636-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.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" Signed-off-by: Tim Wiederhake Reviewed-by: J=C3=A1n Tomko --- src/util/virlog.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/src/util/virlog.c b/src/util/virlog.c index f6d0c6c050..de36da1a4a 100644 --- a/src/util/virlog.c +++ b/src/util/virlog.c @@ -1308,7 +1308,6 @@ virLogFilterNew(const char *match, virLogPriority priority) { virLogFilterPtr ret =3D NULL; - char *mdup =3D NULL; size_t mlen =3D strlen(match); =20 if (priority < VIR_LOG_DEBUG || priority > VIR_LOG_ERROR) { @@ -1317,23 +1316,16 @@ virLogFilterNew(const char *match, return NULL; } =20 + ret =3D g_new0(virLogFilter, 1); + ret->priority =3D priority; + /* We must treat 'foo' as equiv to '*foo*' for g_pattern_match - * todo substring matches, so add 2 extra bytes + * substring matches, so add 2 extra bytes */ - if (VIR_ALLOC_N_QUIET(mdup, mlen + 3) < 0) - return NULL; - - mdup[0] =3D '*'; - memcpy(mdup + 1, match, mlen); - mdup[mlen + 1] =3D '*'; - - if (VIR_ALLOC_QUIET(ret) < 0) { - VIR_FREE(mdup); - return NULL; - } - - ret->match =3D mdup; - ret->priority =3D priority; + ret->match =3D g_new0(char, mlen + 3); + ret->match[0] =3D '*'; + memcpy(ret->match + 1, match, mlen); + ret->match[mlen + 1] =3D '*'; =20 return ret; } --=20 2.26.2