From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on sa.local.altlinux.org X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684742252; x=1687334252; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=dXaIZ1mVyEOE/UOFr1qM2DYbSqIQPIDU+KERhhgaoKU=; b=ASalHG8R4EVStmvasJKZ0OEhDffo5lxxe/mbUmqdhH7MDZ9yCpjq4iaNkiFKCBzb3J hfF1JHxK8Tj9sfJnlfTG15bcxSw2rsqyCLzkrIdSufXxzCN+9LWbcGypuS+l6TfWvblC 8ya1PMpD0wdJUxCjvJZoNt7AHaZr6g7q0Sk4DbYosY390qvZgk+NvPYeei+hxT/nP48p JWnimifbRRTviAlVJhwRMSKEOqWFOAatdyAdQxPKxw4+PDeXmC/gbE6YtF0Eko7KhwTI MIN7xcPfzXYXrhwLEZjIDD0l3Bfb5ABdf8s3i7r0XTDrDtu5iI0ARFZEiBP/LhygoTYj Ak+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684742252; x=1687334252; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dXaIZ1mVyEOE/UOFr1qM2DYbSqIQPIDU+KERhhgaoKU=; b=KPO+b1y/+2sUAJ9txYw1XD6kiO/OBku0IKFpnilEdpnUbvaXIDDcJV0tOytjDOHeUO eZM6/hZAgLVkMygI4SlXVipaXZStq8kyAnUJQiRCpbzjFRNEW55rIkqC3KCaFPFbfLtk D3IF2/6xxG0zKuuHJreUl7zVdgjMShznDQ69DLDHIFV7SUw5UuIiP6BRMnzS4Y9NQZJ+ dng+7t7Fy2A82sEavCJXClII3hd72GcwxqN0/gLWcmXmjLAQEhI3qI+ODFxtEdW102qA aIyjzhZ16qgHI//M9c/3fqhuaetvc3T+/J+MiwrsTHMaO8svUZGlCR4H7k1j74Ru1n65 76gw== X-Gm-Message-State: AC+VfDwQin1tnvX8twN/JBPmyVcAIlUHQ4V9IQpWVeIPcze4gZzTzLlC 0wIn5JzWUQuK7E4F0D2qWzuNoIefoBc= X-Google-Smtp-Source: ACHHUZ7k/wl47+MXBc1DW50zoTrg/2LKRQ2qn/N+d2jhXilixDNeYvmF/77kvEJvwGIQjXbW/G8cqg== X-Received: by 2002:a5d:4e8c:0:b0:306:37ec:656c with SMTP id e12-20020a5d4e8c000000b0030637ec656cmr7057872wru.66.1684742252286; Mon, 22 May 2023 00:57:32 -0700 (PDT) From: Alexey Gladkov To: make-initrd@lists.altlinux.org Date: Mon, 22 May 2023 09:57:22 +0200 Message-Id: <20230522075723.486638-1-gladkov.alexey@gmail.com> X-Mailer: git-send-email 2.33.8 In-Reply-To: <6258d160-9ffc-30de-abda-d6aec405559a@gmail.com> References: <6258d160-9ffc-30de-abda-d6aec405559a@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [make-initrd] [PATCH 1/2] ueventd: Fix memory leak X-BeenThere: make-initrd@lists.altlinux.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: make-initrd@lists.altlinux.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 May 2023 07:57:35 -0000 Archived-At: List-Archive: Fixes: 31cbad99 ("Reimplement ueventd") Signed-off-by: Alexey Gladkov --- datasrc/ueventd/ueventd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/datasrc/ueventd/ueventd.c b/datasrc/ueventd/ueventd.c index afe050d0..c2c23ba3 100644 --- a/datasrc/ueventd/ueventd.c +++ b/datasrc/ueventd/ueventd.c @@ -104,8 +104,10 @@ int watch_path(int inotifyfd, const char *dir, const char *name, uint32_t mask, rd_asprintf_or_die(&path, "%s/%s", dir, name); int wfd = add_queue_dir(inotifyfd, path, mask); - if (wfd < 0) + if (wfd < 0) { + free(path); return (wfd == -128 ? 0 : wfd); + } if (stat(path, &st) < 0) { rd_err("stat: %s: %m", path); -- 2.33.8