From patchwork Tue Sep 8 18:49:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yonggang Luo X-Patchwork-Id: 11763959 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3A42E618 for ; Tue, 8 Sep 2020 18:59:22 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F1B862068D for ; Tue, 8 Sep 2020 18:59:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="dZ61gXHr" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F1B862068D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:36270 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFipt-0003ij-4E for patchwork-qemu-devel@patchwork.kernel.org; Tue, 08 Sep 2020 14:59:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55252) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFihV-0003al-7D; Tue, 08 Sep 2020 14:50:41 -0400 Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]:53408) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kFihT-0002on-DY; Tue, 08 Sep 2020 14:50:40 -0400 Received: by mail-pj1-x102f.google.com with SMTP id t7so62701pjd.3; Tue, 08 Sep 2020 11:50:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NnBwIumxkiQ9pXVAp8TmFXF/H8dsT5OnHNvh40zg8GM=; b=dZ61gXHrueNmi8e4+i/f5VjPIc3SbBIj26rqqDK8YpFPdoVNxHukAD/T967bpZlWNo 2kSafz843mWWsSGaY0VSc3D/lV0aA5k364u9eA5v1JFfdAlfisGTA/rDfRVm1rez7FaD hCrZTtjXhq0tfIqrz6kpuXIrf+dU+nNhXhmbCzDg3YkDlyITZifS6rWkKvHpuEhDrPAf UWc2cORqtnXurqGXU799QdXDb29nS9DLDR+LWSPNaYGpSq/7X7/wfWiO/4MXknAUpi8Z dwPlpPYkvCwc0GNteYXZVLUF2TC+vvm5Z0DLJa4ckwnezwosXy3QHHSvZtwnpjgKPu9S wpWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NnBwIumxkiQ9pXVAp8TmFXF/H8dsT5OnHNvh40zg8GM=; b=Ei8/hboDXIkSRPlzDY74gLvT2OvNZzkv6UqOtdzazTk17/N7/48tik15hkygYHhVXl uwor2ZzPS2gN5ECznEK3BIiyJqKOeL3gmaTQ2fpa8Di5oLUGY7abTw2iVFhtCw1W0pzp acwT5pZhUV/3muZtcQD6yKfGfch0rjIsbS6qV2xEkSLVyRIIaoCUuZ0DWY0eRsC5/2IY tnctxIw2PkUVLHo22LT0Ubqc8mpGpCz2hlwHv4m/fvZ42FlsSv4SAR0GGK5TEQVHfxrj yOgTgZD1YAarpY1DSnJjbc6htmSf6cIRZLO9pYALU/v6RBo3Khao52uoH0vgx2hTwfC/ cTnQ== X-Gm-Message-State: AOAM532/JSdHsDZvenkpik7Y77Df7L2ltS4LRMgMxofgjtxnOzCExEO7 pyYJ6boYYV+rkt+ZzckoTGy5DH3y8bx4X0U3 X-Google-Smtp-Source: ABdhPJw7QsEuGqVB+fe4fIKSLWPRF/h3iM9/7Dslogjs3svpC/7HSG+UhzlGqie0zhflEaNfUxo3Yw== X-Received: by 2002:a17:90a:6848:: with SMTP id e8mr173323pjm.221.1599591037058; Tue, 08 Sep 2020 11:50:37 -0700 (PDT) Received: from localhost.localdomain ([222.95.248.6]) by smtp.googlemail.com with ESMTPSA id 8sm43553pjx.14.2020.09.08.11.50.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Sep 2020 11:50:36 -0700 (PDT) From: Yonggang Luo To: qemu-devel@nongnu.org Subject: [PULL 15/16] logging: Fixes memory leak in test-logging.c Date: Wed, 9 Sep 2020 02:49:17 +0800 Message-Id: <20200908184918.1085-16-luoyonggang@gmail.com> X-Mailer: git-send-email 2.28.0.windows.1 In-Reply-To: <20200908184918.1085-1-luoyonggang@gmail.com> References: <20200908184918.1085-1-luoyonggang@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102f; envelope-from=luoyonggang@gmail.com; helo=mail-pj1-x102f.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Ed Maste , Michael Roth , qemu-block@nongnu.org, Stefan Weil , Xie Changlong , Peter Lieven , Markus Armbruster , Max Reitz , Yonggang Luo , Gerd Hoffmann , Wen Congyang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Li-Wen Hsu Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" g_dir_make_tmp Returns the actual name used. This string should be freed with g_free() when not needed any longer and is is in the GLib file name encoding. In case of errors, NULL is returned and error will be set. Use g_autofree to free it properly Signed-off-by: Yonggang Luo Reviewed-by: Philippe Mathieu-Daudé --- tests/test-logging.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test-logging.c b/tests/test-logging.c index 8a1161de1d..957f6c08cd 100644 --- a/tests/test-logging.c +++ b/tests/test-logging.c @@ -196,7 +196,7 @@ static void rmdir_full(gchar const *root) int main(int argc, char **argv) { - gchar *tmp_path = g_dir_make_tmp("qemu-test-logging.XXXXXX", NULL); + g_autofree gchar *tmp_path = g_dir_make_tmp("qemu-test-logging.XXXXXX", NULL); int rc; g_test_init(&argc, &argv, NULL);