From patchwork Fri Oct 29 05:09:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Hilliard X-Patchwork-Id: 1547821 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.a=rsa-sha256 header.s=20210112 header.b=gn4Qagn+; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=H/oK7EoM; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2607:f8b0:4864:20::33d; helo=mail-ot1-x33d.google.com; envelope-from=swupdate+bncbcl4hcw73qcbbkee52fqmgqe6abx7oq@googlegroups.com; receiver=) Received: from mail-ot1-x33d.google.com (mail-ot1-x33d.google.com [IPv6:2607:f8b0:4864:20::33d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HgVqL4JMPz9sRK for ; Fri, 29 Oct 2021 16:10:04 +1100 (AEDT) Received: by mail-ot1-x33d.google.com with SMTP id l71-20020a9d1b4d000000b00553d78fb5c3sf3947393otl.16 for ; Thu, 28 Oct 2021 22:10:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1635484200; cv=pass; d=google.com; s=arc-20160816; b=wRQJrkGyL/eJCX7/va0vPN3K9ryYUk67GdN8zYB6UJ8PMMP7i/ppqiEoPt5dyEgp4v JSiEA+6YafipBAMg+gXe8nnu/7h8Eanfd1P2vKRRh7uZ/+wB4/eHPJR7/Nc6Sq3Hv/Sn 4g6i9tBe2pQfs21EyBld3AcUkAdPW08lUlUPIb7sxeIGlXiaa05jJHXvhrAlCXcxbK32 3P1CQXVXOLIbCtWT/Fd2Pzo8TV+KJ3uCGP8MTRIBh5GS60xlormiNB0FkkXAVfYGJqIj wrZZEpBqElTsQFMpQ96u9pYngO/queS+hsiF3QWaFk/l2l9cf7usFiskAMjnvxm5V7EQ 1HWw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:mime-version:message-id:date :subject:cc:to:from:sender:dkim-signature:dkim-signature; bh=4BGSWytPgLw5Uk7sUD0w851ntu72T39z5eEX2kYW8fA=; b=jRKBHP4fBZz44qAaSsBeksCLElE2cxeFGZ7lBQ6BZ7t4lpYoZt75CDOpyq923Hcf3n EbJiYq/cx3tfOxUOX4u6tX/hEPIchJGlAXiu9jXmt8WAecFOHeCoX5d1+2TJjxR69E0+ KiYiD76t7EMWczhORndAOnehswhXAqedup84ZZsFub7bkHOkYX2uDhpSxKXUTmz6rQAN D0syV/0EMmdvcFDYfZRIk5v7CckXSqlGA/WN3IOiJh2fdtaTV6s9PbpEvjCfEaY9vhTV pe9FnsxT3+9okTQQf559yxIHb3OFlqFmbJFwahYh12A7iTaxiTB6RhJMaxGOZKvRaR54 iMKA== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=im1pJTVJ; spf=pass (google.com: domain of james.hilliard1@gmail.com designates 2607:f8b0:4864:20::d2b as permitted sender) smtp.mailfrom=james.hilliard1@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:mime-version :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=4BGSWytPgLw5Uk7sUD0w851ntu72T39z5eEX2kYW8fA=; b=gn4Qagn+Bh2btbjIwQutHKchdJqQILDtKbR3RnKzY23FVuJyaxXpSPEbz0Ful43gwc dxMaaRVMqpVFvlSG1AoBkWsXR8BwfICn4uGxDkV8IpoQiYZAzlU2LcNWMMaCsRHcdEIt kiP0y/RRmilpcJIyg6ffbUnz4ivK04H2iwNZ7873szHY/xBlllZrurEjz2gQ2GNjs+Od f4KsBb9FMQQjBLB1ud2cQiTKpTfDvtXa/hXRYjm7wUe3NSfNtM7EHPfwWPynHBw3BYLR pfwJw8WJAn/kavHIiBly3VDzYd34mk3r168TEMZdQ9aSIXwyN+orWbTBtQf4QRlgdrC3 q0cg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-subscribe:list-unsubscribe; bh=4BGSWytPgLw5Uk7sUD0w851ntu72T39z5eEX2kYW8fA=; b=H/oK7EoMCkNSVae2heCLUKWJDAil7gzKkDMeas8tP/GzE+WhrDeHxAE/9zE1dj27+c qvM7aSYgx1dd48Dmtpnxu3oG37xGSZzS1mGhAcR+d+dzaihRrlowstebpU3/Ii2pbdHu kbQoIpp8nb+xvyfL8FOnjU7G0+63gZyqCTZQinpiu2QryKBNomLjPTcFdsWs4dy+Ubu4 jvZAVwMS2eryf/RPBKgrIH4AHSj7fA3a1Q7bI1R/XRsEh/lE+pztEIQV6EKSj4M67qP0 31WdBjs1AAwGp2C3gIpL93cwlbqvd7LT3ZW7xIyJ+6sa7KyGK0CqTo0xreAsivg2YEPN 5E6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=sender:x-gm-message-state:from:to:cc:subject:date:message-id :mime-version:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post :list-help:list-archive:list-subscribe:list-unsubscribe; bh=4BGSWytPgLw5Uk7sUD0w851ntu72T39z5eEX2kYW8fA=; b=DpzvQoBbtSHmiAIxlIg6sQixxzaN7ETN9/4ytDg+eWr+VH1kF3rC9N83X089m3eb1K gKcC5APqcTkPlZeuNixeckmkZbXPdySztvi1fAnl+OQ7rvPFW5oNKqmIXbTfRGTfHc7+ IBv/CK0P2BIAoA6b4h+3GpS636hFlszxNOuhqNIiSFgc1Csok/GwVygKrVrh7R9KHMV7 +YEZro0bnuS2d/PmQ25hVc0VtUAIWGbirz7L9a5Mw286gu9BPAcmixwvxSk3B00J77Nf mSUiBkEyg1WG0LnZotW4uJOkhi567aj35g3yZ5tNsaL4MenAsPC9WLbmXoZ5tfLe3daE QFTg== Sender: swupdate@googlegroups.com X-Gm-Message-State: AOAM531sbpJFYAaJSs8gOyjRIBKOouKpa7Y/+rRHNKZggHcHQmDLzPqf WCHMV5wEdNhO3IR2aVfOMX4= X-Google-Smtp-Source: ABdhPJwjTE0mOGUU6Rjc2hPm8mxL9lThrudl99THvqR2ecwAMvGj/FYu+wYm9S8RMJZqbwrVJW5Kfw== X-Received: by 2002:a05:6808:1827:: with SMTP id bh39mr516999oib.142.1635484200339; Thu, 28 Oct 2021 22:10:00 -0700 (PDT) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a9d:19e7:: with SMTP id k94ls1586847otk.7.gmail; Thu, 28 Oct 2021 22:09:59 -0700 (PDT) X-Received: by 2002:a9d:67d8:: with SMTP id c24mr6828500otn.308.1635484199746; Thu, 28 Oct 2021 22:09:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635484199; cv=none; d=google.com; s=arc-20160816; b=D/JDsTB9ijlrVZLFUwlX10q4PrwgloGdVwBuTYqreew+Y6VE1GzA+zXfJyYHSM6DCU T1BW84nBgEzA5Dch3hVUv84D8VYGXVsinP79xdxUMQ8fH2Uj7sSVNDIunosf2hAen1Ze 1uvlYDLuetwg96+MEaIAZU3IsdHCTHk1/RsWIVu2Azz6I4VLvV0x/rxTSRgZ11LSyADe cdZ/IhquouxdH/ba0saQNgzTCiyTh6LnI+qPAL1tKGJO1PUO/M7Qpyzeb8MNJH6RtBXS Op0WSOhdOG1m2PzaF0sz/QU6MSjmjkV+I55Af7e77ve96pYF7Y39wE5HqcwVRGCQ1KCe I7Zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=9PQr8x35TeXhbBjZ5u9IxDnVe/a8ZLuS4mzJfRGnpMQ=; b=yD/csuuqFtoz93JGtJi8E50pPT0qRNCbMGf2o7DneBEIi2qX23slNprpbIr4dWLT3x qXK1xNNpFfOi+IK4Uyd4J2QPDYIAJrSEAhMp02YGJIudXHWwvupE09Q8FpPVTgZIi4vE F1HEXEQI4TyjHXEP6HsZ/ijxZH6IG4IBmUNd7IDvJF1ZRmvwahXcEt7kORICxFJPGMvU Uf6+BnJPayj1yVMndalB9TW/KyHb7qJSbD19X2dmTa+P92MiKjqMwNOE0KFWaB3LdK1c p3d4KJu+I9Hw23xCMJUUF6HeM6Y/r+/AG0oyLh9pPobzWVr+5y+UiX6PoLuB2WdGRFEz B1ug== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=im1pJTVJ; spf=pass (google.com: domain of james.hilliard1@gmail.com designates 2607:f8b0:4864:20::d2b as permitted sender) smtp.mailfrom=james.hilliard1@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from mail-io1-xd2b.google.com (mail-io1-xd2b.google.com. [2607:f8b0:4864:20::d2b]) by gmr-mx.google.com with ESMTPS id m3si258593oif.3.2021.10.28.22.09.59 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 28 Oct 2021 22:09:59 -0700 (PDT) Received-SPF: pass (google.com: domain of james.hilliard1@gmail.com designates 2607:f8b0:4864:20::d2b as permitted sender) client-ip=2607:f8b0:4864:20::d2b; Received: by mail-io1-xd2b.google.com with SMTP id h81so2323152iof.6 for ; Thu, 28 Oct 2021 22:09:59 -0700 (PDT) X-Received: by 2002:a05:6638:2b5:: with SMTP id d21mr6700047jaq.133.1635484199091; Thu, 28 Oct 2021 22:09:59 -0700 (PDT) Received: from MacBook-Pro-2.localdomain (71-218-115-49.hlrn.qwest.net. [71.218.115.49]) by smtp.gmail.com with ESMTPSA id f20sm2296485iow.15.2021.10.28.22.09.58 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Oct 2021 22:09:58 -0700 (PDT) From: James Hilliard To: swupdate@googlegroups.com Cc: James Hilliard Subject: [swupdate] [PATCH 1/1] diskpart: fix context memory leak in hybrid mode Date: Thu, 28 Oct 2021 23:09:56 -0600 Message-Id: <20211029050956.59817-1-james.hilliard1@gmail.com> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 X-Original-Sender: james.hilliard1@gmail.com X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=im1pJTVJ; spf=pass (google.com: domain of james.hilliard1@gmail.com designates 2607:f8b0:4864:20::d2b as permitted sender) smtp.mailfrom=james.hilliard1@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , It appears that fdisk_unref_context doesn't automatically free the parent context, so we need to do so explicitely. Signed-off-by: James Hilliard --- handlers/diskpart_handler.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/handlers/diskpart_handler.c b/handlers/diskpart_handler.c index f9327b5..e08c10e 100644 --- a/handlers/diskpart_handler.c +++ b/handlers/diskpart_handler.c @@ -739,6 +739,13 @@ static int diskpart_write_table(struct fdisk_context *cxt, struct create_table * return ret; } +static void diskpart_unref_context(struct fdisk_context *cxt) +{ + if (IS_HYBRID(cxt)) + fdisk_unref_context(PARENT(cxt)); + fdisk_unref_context(cxt); +} + static int diskpart(struct img_type *img, void __attribute__ ((__unused__)) *data) { @@ -945,7 +952,7 @@ handler_exit: WARN("Error deassign device %s", img->device); handler_release: - fdisk_unref_context(cxt); + diskpart_unref_context(cxt); /* * Kernel rereads the partition table and add just a delay to be sure