Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3634039rwb; Sun, 25 Sep 2022 09:49:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4d6XIIAiD39wG4ogQWkxLLJr5B99PGyT80nI88cwaYp/N0a9KTDWW7SHKe8hpCq3B++W4x X-Received: by 2002:a17:906:4bd3:b0:731:3bdf:b95c with SMTP id x19-20020a1709064bd300b007313bdfb95cmr15105946ejv.677.1664124554000; Sun, 25 Sep 2022 09:49:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664124553; cv=none; d=google.com; s=arc-20160816; b=dJsMh8UBw5w7d3bOJgSwbvQszdzvdVIY2Z5Zo9GtjRQLhKAeOzISC0YBIJkdgEmN1M L2F2mnaXG7dLubOUcbHiOPTAUZNsrdcqaqFjjhk2WCX0jYdRDLSHmUlpHss8UqKgRCoS BSaWaUBqFHrTiIJZfCYzmAe4Yl1KcKqJuYAcg9jaBXqu+wac/0hUH/xsq210s7sNNCei fl2ob2JvykazINVGyHUQSOisi0J8QlKxkWAQIMib89ab1n9vET7OwbGlKtHjPVbAFRoy jCCUrJ/+3OK5Vdyp3qBe7UCR4eVWaebokFOCjHrqJkHfHohfEyanCuHRMveWAxcjCRco w+GA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:sender:dkim-signature; bh=hWfzItsWPiZ1ZzGA3E480CEVlONEPGsPslhrATTWDCQ=; b=biWDs3+1qFaZdvSV2ZsO5hUAlT4mUrNA22PhskqJAaOHDVLCjVrwK4/Ae76r+rN8RE 1/zPlz3o8beJxwJRCXMChYHbxLvL+tJSSMVRjqFcjH7PJFecHLh5G72cFUP84rrkBzIg y8uFBfBSh0QO27Lg86jAYsmPZttd/bgTS/0TDWiVaJ2A8FwMOpRz69h6xdIPdmPuX1A6 wMseT/xjecYemcHpPF7oP36gyU/jClZQB6gVN9AhlDB2sDAsxMKS4bCyMDBjlUySNyDp DUk/SmRF817S3Z4Rqlox2GCLc388Nv77EL+yTDiJ9Z5tVxBCbpJUrzk2TqEmiPAKeI0W DE5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@hexchain.org header.s=smtp header.b=Smr1fI+5; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=hexchain.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hb43-20020a170907162b00b007825aef1960si11819006ejc.34.2022.09.25.09.48.36; Sun, 25 Sep 2022 09:49:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@hexchain.org header.s=smtp header.b=Smr1fI+5; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=hexchain.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229561AbiIYQgv (ORCPT + 99 others); Sun, 25 Sep 2022 12:36:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230387AbiIYQgu (ORCPT ); Sun, 25 Sep 2022 12:36:50 -0400 X-Greylist: delayed 301 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Sun, 25 Sep 2022 09:36:49 PDT Received: from rs225.mailgun.us (rs225.mailgun.us [209.61.151.225]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2817325EB4 for ; Sun, 25 Sep 2022 09:36:48 -0700 (PDT) DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=hexchain.org; q=dns/txt; s=smtp; t=1664123808; x=1664210208; h=Content-Transfer-Encoding: MIME-Version: Message-Id: Date: Subject: Subject: Cc: To: To: From: From: Sender: Sender; bh=hWfzItsWPiZ1ZzGA3E480CEVlONEPGsPslhrATTWDCQ=; b=Smr1fI+5e2hFwre5Ck5PcA2N+hW/fC8db5sMdk6V7jmNZck/LgVV4W44X3Mz5KRB+x9XkSAW 7C0HBmb8nU32NhMkEQchIDJn7T6WeJ7EJcfOU0I1hIVkR118waYlaQUqLxPqMMxzbRe8jFgk o79zKpYlJX9kU7Bd82nKgIa1nfkZG/fpjbWiVxFqZXTnuUMTW6wBXvwJd9gMf3q9pxTc6aT4 b4i+LzwLA+AhRDJq8Q/A62Psd0SftEmDkDz4sTvPaFUtdmesXGKubGY2ZEqLtMnrhx3yWUZn K3/50HLRfykcpABqLAw1xrkFryv0y6XSxoBrmGar/EVXYGZfgR7w/g== X-Mailgun-Sending-Ip: 209.61.151.225 X-Mailgun-Sid: WyJiNzllYSIsImxpbnV4LWJsdWV0b290aEB2Z2VyLmtlcm5lbC5vcmciLCIxOTI1MTgiXQ== Received: from localhost (254.248.75.138.unknown.m1.com.sg [138.75.248.254]) by 8bda31290a10 with SMTP id 633082724618b2fed687bc7c (version=TLS1.3, cipher=TLS_AES_128_GCM_SHA256); Sun, 25 Sep 2022 16:31:46 GMT Sender: i@hexchain.org From: Haochen Tong To: linux-bluetooth@vger.kernel.org Cc: Haochen Tong Subject: [PATCH BlueZ] tools/mpris-proxy: unregister object path if player registration fails Date: Mon, 26 Sep 2022 00:31:39 +0800 Message-Id: <20220925163139.194382-1-i@hexchain.org> X-Mailer: git-send-email 2.37.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_40,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org The `owner' string, passed as user data, is freed if the player fails registration, but the object path still exists. Upon program exiting, the lingering path will be enumerated and the attached user data will be freed again. --- tools/mpris-proxy.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/mpris-proxy.c b/tools/mpris-proxy.c index 3779b6887..e5fc91fdb 100644 --- a/tools/mpris-proxy.c +++ b/tools/mpris-proxy.c @@ -480,6 +480,7 @@ static void add_player(DBusConnection *conn, const char *name, reply = dbus_connection_send_with_reply_and_block(sys, msg, -1, &err); if (!reply) { fprintf(stderr, "Can't register player\n"); + dbus_connection_unregister_object_path(sys, path); free(owner); if (dbus_error_is_set(&err)) { fprintf(stderr, "%s\n", err.message); -- 2.37.3