From patchwork Mon Dec 13 11:15:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konstantin Kostiuk X-Patchwork-Id: 12673755 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id DF825C433F5 for ; Mon, 13 Dec 2021 11:22:32 +0000 (UTC) Received: from localhost ([::1]:40700 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mwjPb-0007Dt-T9 for qemu-devel@archiver.kernel.org; Mon, 13 Dec 2021 06:22:31 -0500 Received: from eggs.gnu.org ([209.51.188.92]:47556) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwjJV-0008WG-Vc for qemu-devel@nongnu.org; Mon, 13 Dec 2021 06:16:15 -0500 Received: from [2a00:1450:4864:20::531] (port=39836 helo=mail-ed1-x531.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mwjJS-0007FQ-EX for qemu-devel@nongnu.org; Mon, 13 Dec 2021 06:16:13 -0500 Received: by mail-ed1-x531.google.com with SMTP id w1so50655171edc.6 for ; Mon, 13 Dec 2021 03:16:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20210112.gappssmtp.com; s=20210112; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=Tcy7w82Xek+qCwwIDIGTA5uHT+rhsP1JaipQYEHlTxQ=; b=WN7db/MBa5RGrOL66We0/5uw4NC/vkfqvf6Kn4rC+pkZTW0Rxg4oflF8RTCl3Zp/hU SS+Ivh4aQfuQt7j8kY9ovVDxZo9ZKjhA93CYhr4ykR2agOZ/SRzPMwAiD1gTtjX3nkPz Q4ajDyKd32uAQMnHXOC0vSko2MK0Gl8rg2+qfey6XpPhgr34qBsmvAzuJIR9gU8jmJH7 v60UFgHNqBRVKqME4qAFBASkQWZosuuO22wImFWnFcQFfQTUXZZPqvY+ROL7HhICWm+p nGKCg4HCTKqSHQS6Y9bSrDL2Yq0qtFw/FFsWQWWDTNZTmtrnezX/18y4HiXhz0Bl7bJ+ 1veQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=Tcy7w82Xek+qCwwIDIGTA5uHT+rhsP1JaipQYEHlTxQ=; b=7r00EFuw3tgeJ06UETYtOt9JvN/Z1iAa0BaRUn9a4YM87unPgrJaQMTv02yMmRtqBG yP5wOABptS/dpWiUmbS+MiD0IugNOOj5oY6aCXd39FKm9OPQfRdNoL/F3o1X7r6xeKIl hyv8Iz7SxALpTo+oI1KYMcScUkzBtjLqT+Z3KOp8bf7QorIO5IyFjvsi6PisYnaPeS/V kqvZeKU8pht14NRB/AAx0QYnx9Jetze4zszzMWLjmfpRfPvBCxnkMa1UcyMxb369yWln eVt8gL93IJaFbbdp/MkLsUB1RHYW1S3mfZ/c/qLkMYiCrhWeDroUAxKqZMz77kR1UT1X /q/g== X-Gm-Message-State: AOAM5330tn/PsPXFSRLA8aTmWJEawLd3S06vhUXK6qAwwiCGMfdvcIlk ejhSU76hc9RS0ASbPoj1OQNXLWZp37KWGg== X-Google-Smtp-Source: ABdhPJwJEeKwq7Dl363C+I1D717cV2vh4+6lXfIFf4oGZGjT+8NB3kqrzJW1qBAjQd30Sm+KG+an1Q== X-Received: by 2002:a17:906:5d0b:: with SMTP id g11mr43203910ejt.295.1639394165274; Mon, 13 Dec 2021 03:16:05 -0800 (PST) Received: from kostyanf14nb.Dlink ([37.72.42.118]) by smtp.gmail.com with ESMTPSA id a13sm6139384edk.29.2021.12.13.03.16.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Dec 2021 03:16:04 -0800 (PST) From: Kostiantyn Kostiuk To: qemu-devel@nongnu.org, Michael Roth , =?utf-8?q?Ma?= =?utf-8?q?rc-Andr=C3=A9_Lureau?= , =?utf-8?q?P?= =?utf-8?q?hilippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 0/5] gqa-win: get_pci_info: Fix memory leak Date: Mon, 13 Dec 2021 13:15:49 +0200 Message-Id: <20211213111554.62394-1-konstantin@daynix.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::531 (failed) Received-SPF: none client-ip=2a00:1450:4864:20::531; envelope-from=konstantin@daynix.com; helo=mail-ed1-x531.google.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" This set of patches fixes memory leaks in the get_pci_info function when it fails to get parent device data. In this case the parent_dev_info and the parent_dev_id variables will be initialized, but not freed. Bug: https://bugzilla.redhat.com/show_bug.cgi?id=1958825 Kostiantyn Kostiuk (5): gqa-win: get_pci_info: Clean dev_info if handle is valid gqa-win: get_pci_info: Use common 'cleanup' label gqa-win: get_pci_info: Free parent_dev_info properly gqa-win: get_pci_info: Replace 'while' with 2 calls of the function gqa-win: get_pci_info: Add g_autofree for few variables qga/commands-win32.c | 74 ++++++++++++++++++++++++++++---------------- 1 file changed, 47 insertions(+), 27 deletions(-) --- 2.25.1