From unknown Fri Jun 20 07:16:17 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#35179 <35179@debbugs.gnu.org> To: bug#35179 <35179@debbugs.gnu.org> Subject: Status: [PATCH] Plug memory leak in GTK x-display-monitor-attributes-list Reply-To: bug#35179 <35179@debbugs.gnu.org> Date: Fri, 20 Jun 2025 14:16:17 +0000 retitle 35179 [PATCH] Plug memory leak in GTK x-display-monitor-attributes-= list reassign 35179 emacs submitter 35179 Alex severity 35179 normal tag 35179 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Sun Apr 07 01:17:04 2019 Received: (at submit) by debbugs.gnu.org; 7 Apr 2019 05:17:04 +0000 Received: from localhost ([127.0.0.1]:47690 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hD0Ay-0005dr-Bd for submit@debbugs.gnu.org; Sun, 07 Apr 2019 01:17:04 -0400 Received: from eggs.gnu.org ([209.51.188.92]:53502) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hD0Aw-0005Y9-KC for submit@debbugs.gnu.org; Sun, 07 Apr 2019 01:17:02 -0400 Received: from lists.gnu.org ([209.51.188.17]:54152) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hD0Ar-0005SB-Ag for submit@debbugs.gnu.org; Sun, 07 Apr 2019 01:16:57 -0400 Received: from eggs.gnu.org ([209.51.188.92]:39650) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hD0Aq-0002Gb-5k for bug-gnu-emacs@gnu.org; Sun, 07 Apr 2019 01:16:57 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hD0Ap-0005Ra-6t for bug-gnu-emacs@gnu.org; Sun, 07 Apr 2019 01:16:56 -0400 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]:37412) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hD0Ao-0005R9-Nh for bug-gnu-emacs@gnu.org; Sun, 07 Apr 2019 01:16:55 -0400 Received: by mail-pf1-x42f.google.com with SMTP id 8so5654078pfr.4 for ; Sat, 06 Apr 2019 22:16:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:user-agent:mime-version; bh=hF1/Jpr+IrvwaAciwKx6m4PbumO6iDQzX3dmMZCfzmw=; b=Ub8vvCeC+FI7lIJ8K/9j9boN3/V/uMFx40Io1zhAsGhpvnSVk04kpRd+L7fT+gjbA3 VG9LzFTEqpFDx1Xt7c7CGYeMk5NkzLpkiAfeQzDIHOBgFvDlI/T+EqG9F7LgDeAtoq5O s2phTcTx7C6omczD+mXokjnEjaPrIQfVE9wn1iV6ybuWLc2HMXanO22vlTOLQHIy8/Ei mWdBS6+iNq8pKAwAWUxZQ1/tkKwvZD0rdOdLpKxXoyD4dGQ2ruOTCTmFNrX06Zp54ALI A6+M54hOVkkCijTPPnN1CKrly+5JBbcSdccjRXzgnKaegBvK5wWWXh09psjiDZqYmVP2 RpVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:user-agent :mime-version; bh=hF1/Jpr+IrvwaAciwKx6m4PbumO6iDQzX3dmMZCfzmw=; b=mXEL5kDeRNMK1ppP8N4g1RxZYWEyETUZxxwjdhktuBVFtp44klryFB8NQXP1lvkhl0 zEGDgAuUfH6c3d9+8+I13mYHt0MPks7AOHxmndos+BGdU4i8ufUBvdfhkvmQ41M5opeJ z/q70Ci6YZn4Zhp0xjYCZFYt9AU+370ZIc1QB51tnmFr1r0oYppbZM3R659HBrkjwBHD V7KNGwZHMIM/1ZDyunNbSHJd4qi9l7ti084n0ptC/NVaOLR4GpiJimJc6Y8gTkHcbQ9B SnlSPIpKbeVP8zMj0iYRaSX74QvwcdeseSTMbSuKWklVmQKyNLDWFbdemHcy8JtCJPbQ eBOw== X-Gm-Message-State: APjAAAUIGSehS8J9P5wjz6KQH7NYHvllau0YbrhQE/Em/QXFjCy4P3aB unc3gNyo3P/oUSudDbOhW8d6oEb3 X-Google-Smtp-Source: APXvYqyQTdM/lv059RbMJofTPdW8I6SsYIxORiuJqEJKVd1LJXVdyOQ770yf9lsjD6ikqrVFGcZ4ww== X-Received: by 2002:a63:243:: with SMTP id 64mr21152818pgc.214.1554614213445; Sat, 06 Apr 2019 22:16:53 -0700 (PDT) Received: from lylat ([2604:3d09:e37f:1500:1a72:4878:e793:7302]) by smtp.gmail.com with ESMTPSA id n22sm30634306pfa.51.2019.04.06.22.16.52 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 06 Apr 2019 22:16:52 -0700 (PDT) From: Alex To: bug-gnu-emacs@gnu.org Subject: [PATCH] Plug memory leak in GTK x-display-monitor-attributes-list Date: Sat, 06 Apr 2019 23:16:53 -0600 Message-ID: <87a7h2z96i.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::42f X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) --=-=-= Content-Type: text/plain Also declare `name' in MonitorInfo const to satisfy the compiler. Is it too late to push a memory leak fix like this to emacs-26? --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Plug-memory-leak-in-GTK-x-display-monitor-attributes.patch Content-Description: GTK memory leak >From b9c71187840f72f5145da5794e1ca69d4a074654 Mon Sep 17 00:00:00 2001 From: Alexander Gramiak Date: Sat, 6 Apr 2019 23:02:24 -0600 Subject: [PATCH] Plug memory leak in GTK x-display-monitor-attributes-list * src/xfns.c (x-display-monitor-attributes-list): Plug memory leak and don't needlessly duplicate the model name. * src/frame.h (MonitorInfo): Declare name as pointing to const char. --- src/frame.h | 2 +- src/xfns.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/frame.h b/src/frame.h index ed62e7ace0..b1eedf36a3 100644 --- a/src/frame.h +++ b/src/frame.h @@ -1648,7 +1648,7 @@ flush_frame (struct frame *f) struct MonitorInfo { XRectangle geom, work; int mm_width, mm_height; - char *name; + const char *name; }; extern void free_monitors (struct MonitorInfo *monitors, int n_monitors); diff --git a/src/xfns.c b/src/xfns.c index f238a3daa1..396e77c1db 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -5030,7 +5030,7 @@ Internal use only, use `display-monitor-attributes-list' instead. */) mi->mm_height = height_mm; #if GTK_CHECK_VERSION (3, 22, 0) - mi->name = g_strdup (gdk_monitor_get_model (monitor)); + mi->name = gdk_monitor_get_model (monitor); #elif GTK_CHECK_VERSION (2, 14, 0) mi->name = gdk_screen_get_monitor_plug_name (gscreen, i); #endif @@ -5041,6 +5041,7 @@ Internal use only, use `display-monitor-attributes-list' instead. */) primary_monitor, monitor_frames, source); + xfree (monitors); unblock_input (); #else /* not USE_GTK */ -- 2.21.0 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sun Apr 07 02:37:42 2019 Received: (at submit) by debbugs.gnu.org; 7 Apr 2019 06:37:42 +0000 Received: from localhost ([127.0.0.1]:47718 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hD1R0-00083k-JZ for submit@debbugs.gnu.org; Sun, 07 Apr 2019 02:37:42 -0400 Received: from eggs.gnu.org ([209.51.188.92]:34428) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hD1Qx-00083J-HY for submit@debbugs.gnu.org; Sun, 07 Apr 2019 02:37:39 -0400 Received: from lists.gnu.org ([209.51.188.17]:39521) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hD1Qs-00088x-Bb for submit@debbugs.gnu.org; Sun, 07 Apr 2019 02:37:34 -0400 Received: from eggs.gnu.org ([209.51.188.92]:48807) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hD1Qr-0008WJ-Di for bug-gnu-emacs@gnu.org; Sun, 07 Apr 2019 02:37:34 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=ALL_TRUSTED,BAYES_05 autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:470:142:3::e]:50959) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hD1Qr-00088X-5F; Sun, 07 Apr 2019 02:37:33 -0400 Received: from [176.12.198.195] (port=38085 helo=[10.208.135.60]) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1hD1Qq-0002zA-Bu; Sun, 07 Apr 2019 02:37:32 -0400 Date: Sun, 07 Apr 2019 09:37:29 +0300 User-Agent: K-9 Mail for Android In-Reply-To: <87a7h2z96i.fsf@gmail.com> References: <87a7h2z96i.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: bug#35179: [PATCH] Plug memory leak in GTK x-display-monitor-attributes-list To: bug-gnu-emacs@gnu.org,Alex ,35179@debbugs.gnu.org From: Eli Zaretskii Message-ID: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On April 7, 2019 8:16:53 AM GMT+03:00, Alex wrote: > Also declare `name' in MonitorInfo const to satisfy the compiler=2E >=20 > Is it too late to push a memory leak fix like this to emacs-26? Yes, it's too late for such non-trivial changes in Emacs 26=2E2=2E But I have a more fundamental problem with your proposed patch: it looks l= ike you are relying on implementation details of gdk_monitor_get_model that= its documentation never advertises? Otherwise, how did you know that just= removing the g_strdup call will plug a memory leak here, and will not crea= te any new problems? I'd prefer to leave g_strdup intact, and instead explicitly release the st= orage of previous value=2E IOW, plug the leak in our own code, not rely on= undocumented features which can easily go away some day=2E Thanks=2E From debbugs-submit-bounces@debbugs.gnu.org Sun Apr 07 10:51:27 2019 Received: (at submit) by debbugs.gnu.org; 7 Apr 2019 14:51:27 +0000 Received: from localhost ([127.0.0.1]:48600 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hD98p-0005KN-3U for submit@debbugs.gnu.org; Sun, 07 Apr 2019 10:51:27 -0400 Received: from eggs.gnu.org ([209.51.188.92]:55699) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hD98n-0005K0-Ub for submit@debbugs.gnu.org; Sun, 07 Apr 2019 10:51:26 -0400 Received: from lists.gnu.org ([209.51.188.17]:33860) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hD98i-0003Hn-OK for submit@debbugs.gnu.org; Sun, 07 Apr 2019 10:51:20 -0400 Received: from eggs.gnu.org ([209.51.188.92]:41846) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hD98h-0005CU-MU for bug-gnu-emacs@gnu.org; Sun, 07 Apr 2019 10:51:20 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_20,FREEMAIL_FROM, URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hD98g-0003GW-ML for bug-gnu-emacs@gnu.org; Sun, 07 Apr 2019 10:51:19 -0400 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]:43853) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hD98f-0003FR-0m; Sun, 07 Apr 2019 10:51:18 -0400 Received: by mail-pl1-x644.google.com with SMTP id n8so1222903plp.10; Sun, 07 Apr 2019 07:51:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=M3wQ+cxvY46zgk124mJftWg1ZvKEVTV3/I3/Ochc5ss=; b=XUXzSVpALYSiaYsXiCEJmjIwNNSBYVJMEuTGwaWlHa6yeOEH1x/p/nSqJ0RFOFoyAz wz+L8La2F/WAh1g2a+/NmgYIRhsTK5w9Q99WvKmiF76eWqyMR0lo+QOw12iTDe8HYd4c 6YkeJPmgB1ThwH+3KpeOsh/Rh8JGdbgerTho5vHg0Zva6iIUEmYr22194rtKwJelIUW1 JqqEa0NiO9V7rR4wqQOrqtGsOQKfhU9OcLaMhg2Keo4Ne5GdHP5JuaUZuobvRKy1zL4t x6IvijQ5ZvAno7yPyFzgnvCrklr9reJNgHgWwHkG9tvnSHpq39bSLYpTGpAl9cBNQl3H W4aA== 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:references:date:in-reply-to :message-id:user-agent:mime-version; bh=M3wQ+cxvY46zgk124mJftWg1ZvKEVTV3/I3/Ochc5ss=; b=j6YrunDrYOGZqpqqxBE/42911yuehRaZIe2aG1O2NRvsoGvEWDaFs4dpKyLqcXG0bg oJ9GWQaR8y+Styccao4wrIxW+F+lQO3YM/jJ9C1ZUyaWVhPPkNd27dzwBT8t9TmD1oVU ZalVXq2lRV5NI/iKJl6a2WNWheITmACtxrhWsPB5w3jV/ZjOHjyI5gXhQ/0OkWQgtuS/ eWnNzc2o7700dnY7dyAYRuWU4/i8etWAaEhn/THCUjzBYtNKEyhdmN2eC2DbsJxjHT6v NZHOHJMY4XA2RnqLK7PvbvjE0ZVR60WmBzR0iIAE0JzQUwW2FfoHRca6Xpl67B3XQ3Tv JxCg== X-Gm-Message-State: APjAAAVchESyc052SL4oAUOcQBc0A8DFDemlg8d3U1HZMw8zsSWOB9qQ PV7qolx5qhGNM0C1vjEC8lwPk6GP X-Google-Smtp-Source: APXvYqwdDzoGQDzFnHNpgEdvaGP7h1CN/oVKfSeojU8w369N/TnxVQJKYh07G3sWgo0k8cARLFjQWA== X-Received: by 2002:a17:902:b58f:: with SMTP id a15mr25111680pls.36.1554648675908; Sun, 07 Apr 2019 07:51:15 -0700 (PDT) Received: from lylat ([2604:3d09:e37f:1500:1a72:4878:e793:7302]) by smtp.gmail.com with ESMTPSA id d15sm39528595pfo.34.2019.04.07.07.51.14 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 07 Apr 2019 07:51:15 -0700 (PDT) From: Alex To: Eli Zaretskii Subject: Re: bug#35179: [PATCH] Plug memory leak in GTK x-display-monitor-attributes-list References: <87a7h2z96i.fsf@gmail.com> Date: Sun, 07 Apr 2019 08:51:12 -0600 In-Reply-To: (Eli Zaretskii's message of "Sun, 07 Apr 2019 09:37:29 +0300") Message-ID: <871s2dvpgf.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::644 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: submit Cc: bug-gnu-emacs@gnu.org, 35179@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) Eli Zaretskii writes: > But I have a more fundamental problem with your proposed patch: it looks like > you are relying on implementation details of gdk_monitor_get_model that its > documentation never advertises? Otherwise, how did you know that just removing > the g_strdup call will plug a memory leak here, and will not create any new > problems? > > I'd prefer to leave g_strdup intact, and instead explicitly release the storage of previous value. IOW, plug the leak in our own code, not rely on undocumented features which can easily go away some day. The documentation of gdk_monitor_get_model[1] specifies that the return value is "[transfer none]", which has the description "Don't free data after code is done". The main memory leak, though, was that the MonitorList array wasn't being freed. I considered using the free_monitors procedure like the non-GTK versions do, but I saw no reason to call g_strdup for each name and free each name almost right after. Since make_monitor_attribute_list uses make_string on each name, I don't see any issues that this removal would cause. [1] https://developer.gnome.org/gdk3/stable/GdkMonitor.html#gdk-monitor-get-model From debbugs-submit-bounces@debbugs.gnu.org Sun Apr 07 12:33:05 2019 Received: (at 35179) by debbugs.gnu.org; 7 Apr 2019 16:33:05 +0000 Received: from localhost ([127.0.0.1]:48639 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hDAjA-0007m9-V5 for submit@debbugs.gnu.org; Sun, 07 Apr 2019 12:33:05 -0400 Received: from eggs.gnu.org ([209.51.188.92]:41023) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hDAj9-0007lg-6P for 35179@debbugs.gnu.org; Sun, 07 Apr 2019 12:33:03 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:56713) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hDAj3-00011Z-FT; Sun, 07 Apr 2019 12:32:57 -0400 Received: from [176.228.60.248] (port=4127 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1hDAj2-0003nm-TT; Sun, 07 Apr 2019 12:32:57 -0400 Date: Sun, 07 Apr 2019 19:32:49 +0300 Message-Id: <83wok593ny.fsf@gnu.org> From: Eli Zaretskii To: Alex In-reply-to: <871s2dvpgf.fsf@gmail.com> (message from Alex on Sun, 07 Apr 2019 08:51:12 -0600) Subject: Re: bug#35179: [PATCH] Plug memory leak in GTK x-display-monitor-attributes-list References: <87a7h2z96i.fsf@gmail.com> <871s2dvpgf.fsf@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 35179 Cc: 35179@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) > From: Alex > Cc: bug-gnu-emacs@gnu.org, 35179@debbugs.gnu.org > Date: Sun, 07 Apr 2019 08:51:12 -0600 > > > I'd prefer to leave g_strdup intact, and instead explicitly release the storage of previous value. IOW, plug the leak in our own code, not rely on undocumented features which can easily go away some day. > > The documentation of gdk_monitor_get_model[1] specifies that the return > value is "[transfer none]", which has the description "Don't free data > after code is done". That could mean anything. The only thing it tells us not to call 'free' on the result, but it could be, for example, that the result is a pointer to a static buffer that can be changed by a subsequent call to the function. > The main memory leak, though, was that the MonitorList array wasn't > being freed. Does your patch change that? If not, why not? > I considered using the free_monitors procedure like the non-GTK > versions do, but I saw no reason to call g_strdup for each name and > free each name almost right after. I don't see how the short lifetime of the array changes anything here. As long as we aren't sure the pointer returned by gdk_monitor_get_model is a copy that cannot be changed by another thread, we should ourselves make a copy. Otherwise, who can ensure us that some other GTK thread doesn't call this same function during the short life time of the array? > Since make_monitor_attribute_list uses make_string on each name, I don't > see any issues that this removal would cause. The issue I see is that between the time we call gdk_monitor_get_model and the time we use the string something could change the string to which the pointer points. If you can spot something in the GDK docs that guarantees this couldn't happen, please point me to that piece of docs. From debbugs-submit-bounces@debbugs.gnu.org Sun Apr 07 13:34:41 2019 Received: (at 35179) by debbugs.gnu.org; 7 Apr 2019 17:34:41 +0000 Received: from localhost ([127.0.0.1]:48667 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hDBgn-0000oP-F2 for submit@debbugs.gnu.org; Sun, 07 Apr 2019 13:34:41 -0400 Received: from mail-pl1-f182.google.com ([209.85.214.182]:33448) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hDBgk-0000oA-AW for 35179@debbugs.gnu.org; Sun, 07 Apr 2019 13:34:40 -0400 Received: by mail-pl1-f182.google.com with SMTP id t16so5943435plo.0 for <35179@debbugs.gnu.org>; Sun, 07 Apr 2019 10:34:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=FTnPz6rX8RD9UKnc23dJfwEzjmpMWI6Ez3dt1X+Pdw4=; b=jU1pWUiSLssbs2bVEoLg5VIcI/a/y4VixAWrJHjUu2h3S+zzSg+RG/S8G3o18KTR2K 7SrCdKJ4i4bvYxVbGGO4f/JQo6APhi6xHN0KSsTInKaYcZ84vJzQo0USym0lUAWZURxR J5J1RbZ+fUPzacFS8yNS9CoDIhLTaxKDl2x9f3DOuPyZh6zLyBTDB9XYrAwToUlYeiY6 exMLCA6ad8bXjtmVoFMdTEcdhojsxFALDAkz22Fmo6FAbgK5HTi63WyqFkTC1uR5DFtz fSOTSjf/5wyOuypUpPW1JUw9vXW5lXmNgZnPSj5jm18J5iIZFU02zBRr4/+e4NQ7QzeK 1egA== 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:references:date:in-reply-to :message-id:user-agent:mime-version; bh=FTnPz6rX8RD9UKnc23dJfwEzjmpMWI6Ez3dt1X+Pdw4=; b=mKhD2C9XdqYoYsVBUhxxkJpXMA1dyo45Oj64mbpA/fJuyldz3wnHX76vbOhqHpQ9L2 sxOLyUtqkVWfA8gOUgJn5c5/MLuF6yJ4w8EJSfuFhUydxQ6WUcdGX1Hb3NCfo4a6zrW7 hbwFGwGyiU+oiYsGgINAf0fNullVyFv3kYZ8HFG8Dl9Mb05IAMvsdfutQKPyc70oyk0N 5yrX5Ku9aZVBselJeijxyVuowj52HybTcca8yPij8mHfTOf+r6L0dTYDuucXwDao/RKl UynwnAmdMPsBcFH8Yq3HLxDx/22yYD1m0GWfKVL1jcgoqZp9EZacvYBMDQAKv0NKqL4I CQsg== X-Gm-Message-State: APjAAAUxp+RZF3rTFcPYMmqhfRdAjBWwhh379KsVh84SsvlbXdNtmmaq mQhBD4wlFK211B6FHVlpXTgv3t9V X-Google-Smtp-Source: APXvYqzt7rvBmAO8s1A4qUl4K/yArgK7+gb1VLgmysSYekHdpf9uodoatCqAfyLsOjsMcPuLqGqPmw== X-Received: by 2002:a17:902:201:: with SMTP id 1mr25685997plc.89.1554658472099; Sun, 07 Apr 2019 10:34:32 -0700 (PDT) Received: from lylat ([2604:3d09:e37f:1500:1a72:4878:e793:7302]) by smtp.gmail.com with ESMTPSA id r87sm46469612pfa.71.2019.04.07.10.34.30 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 07 Apr 2019 10:34:31 -0700 (PDT) From: Alex To: Eli Zaretskii Subject: Re: bug#35179: [PATCH] Plug memory leak in GTK x-display-monitor-attributes-list References: <87a7h2z96i.fsf@gmail.com> <871s2dvpgf.fsf@gmail.com> <83wok593ny.fsf@gnu.org> Date: Sun, 07 Apr 2019 11:34:28 -0600 In-Reply-To: <83wok593ny.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 07 Apr 2019 19:32:49 +0300") Message-ID: <87wok5u3bv.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 35179 Cc: 35179@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Eli Zaretskii writes: >> The main memory leak, though, was that the MonitorList array wasn't >> being freed. > > Does your patch change that? If not, why not? It did, yes. That was the xfree (monitors) call. >> I considered using the free_monitors procedure like the non-GTK >> versions do, but I saw no reason to call g_strdup for each name and >> free each name almost right after. > > I don't see how the short lifetime of the array changes anything > here. As long as we aren't sure the pointer returned by > gdk_monitor_get_model is a copy that cannot be changed by another > thread, we should ourselves make a copy. Otherwise, who can ensure us > that some other GTK thread doesn't call this same function during the > short life time of the array? The documentation does state that the name property of the monitor is read-only. >> Since make_monitor_attribute_list uses make_string on each name, I don't >> see any issues that this removal would cause. > > The issue I see is that between the time we call gdk_monitor_get_model > and the time we use the string something could change the string to > which the pointer points. If you can spot something in the GDK docs > that guarantees this couldn't happen, please point me to that piece of > docs. Well, I suppose that the monitor could be unplugged in-between, which presumably would mean that the monitor object is freed. Would that space be reused in-between, though? I suppose it doesn't hurt to play it safe, so I updated the patch to use free_monitors instead: --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Plug-memory-leak-in-GTK-x-display-monitor-attributes.patch Content-Description: v2 >From 490ec531943540cb882b46624a4b7b3b1463a4b8 Mon Sep 17 00:00:00 2001 From: Alexander Gramiak Date: Sat, 6 Apr 2019 23:02:24 -0600 Subject: [PATCH] Plug memory leak in GTK x-display-monitor-attributes-list * src/frame.c (free_monitors) [USE_GTK]: Define in the GTK case as well. * src/xfns.c (x-display-monitor-attributes-list) [USE_GTK]: Plug memory leak. * src/frame.h (MonitorInfo): Declare name as pointing to const char. --- src/frame.c | 4 ++-- src/frame.h | 2 +- src/xfns.c | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/frame.c b/src/frame.c index d0c77149ba..e57f17ded4 100644 --- a/src/frame.c +++ b/src/frame.c @@ -5662,8 +5662,8 @@ selected frame. This is useful when `make-pointer-invisible' is set. */) #ifdef HAVE_WINDOW_SYSTEM -# if (defined HAVE_NS \ - || (!defined USE_GTK && (defined HAVE_XINERAMA || defined HAVE_XRANDR))) +# if (defined USE_GTK || defined HAVE_NS || defined HAVE_XINERAMA \ + || defined HAVE_XRANDR void free_monitors (struct MonitorInfo *monitors, int n_monitors) { diff --git a/src/frame.h b/src/frame.h index ed62e7ace0..b1eedf36a3 100644 --- a/src/frame.h +++ b/src/frame.h @@ -1648,7 +1648,7 @@ flush_frame (struct frame *f) struct MonitorInfo { XRectangle geom, work; int mm_width, mm_height; - char *name; + const char *name; }; extern void free_monitors (struct MonitorInfo *monitors, int n_monitors); diff --git a/src/xfns.c b/src/xfns.c index f238a3daa1..33595afc1e 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -5041,6 +5041,7 @@ Internal use only, use `display-monitor-attributes-list' instead. */) primary_monitor, monitor_frames, source); + free_monitors (monitors, n_monitors); unblock_input (); #else /* not USE_GTK */ -- 2.21.0 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sun Apr 07 13:45:04 2019 Received: (at 35179) by debbugs.gnu.org; 7 Apr 2019 17:45:05 +0000 Received: from localhost ([127.0.0.1]:48671 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hDBqq-00012j-L3 for submit@debbugs.gnu.org; Sun, 07 Apr 2019 13:45:04 -0400 Received: from mail-pf1-f180.google.com ([209.85.210.180]:43101) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hDBqn-00011u-Fi for 35179@debbugs.gnu.org; Sun, 07 Apr 2019 13:45:03 -0400 Received: by mail-pf1-f180.google.com with SMTP id c8so6209229pfd.10 for <35179@debbugs.gnu.org>; Sun, 07 Apr 2019 10:45:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=GoV2kjbzu65EUvb8UHjb7fySzsVqc+WXIhuqfyZJqXg=; b=fq99pF3DA3vMRL30MgCew/t5dPzQgQo9kjsD9w4bsCu9sPm6La5TjK+GMCuEKMbYCr Xr+bb5ZfgcIsOXXUYQAi0A7V/fzHUAEOalxa/CZ8b1DjLiRxU5muHC4lkrZEZZrXRiSr eL3Xhnr1Y/wpTJ4bQwuaJ67tyqsINClxJ+Us7DhrYj6/TdkhAXB8K4A5QPgCiOBmg5wb ONGL4zRo6jgvZqIJa5S0SzdgTO98ULRDQtTQlI6+Uulp2elxgusOWOPbUT4xTTCvlI2h R742oot6DZ661pnzo67lhABbZytORFq6i09urtQzqB9bJgrxqFYPjm73OzDnqCNsaJsU wmFA== 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:references:date:in-reply-to :message-id:user-agent:mime-version; bh=GoV2kjbzu65EUvb8UHjb7fySzsVqc+WXIhuqfyZJqXg=; b=Rp7c2M/q8JW9XABSXAHFAuEpo3yTN9VKpGRGC0iae0YNENOXhJUy89ZkFne7w2oPSi /atJ7BbIXoBdut7ccY29UcqoWj+VDOkoKkSB/0hNoQcxI91ccTbwV5jfDn4L9S5yj4BQ 6lwuN1HKcwg0fyTzkD1tVLpXswclikTDFoh7TqPUu/eF2TSATHzS3V9i5fxInqGvJixF 2D5lluXncabk0emD/+/gA1NQafJpMEyBo9Gi4elaVW4Nz9/S6/XijP9NJyC89b/FKSlb kfkCGn+8x01cui870pIKOJqOG6eo0KfT4k36FY4NP84nvUE+Ser7+zyjEyPM7h6V757A iVOw== X-Gm-Message-State: APjAAAWpEymBYXzJoE0ga2sbtz6QX0BSJGRMASHXzouex0e+eVWTxpyB afmb8Dp9BEPgY8JtqVRcOrB07e/p X-Google-Smtp-Source: APXvYqz6wJ15M52PM8wH4+8wmyb2zCerRcnmQUyYJ+sU1hxS/apU8QvzPEg+VNWG/I07ppKvvD/a8g== X-Received: by 2002:a63:3dca:: with SMTP id k193mr23332770pga.146.1554659095152; Sun, 07 Apr 2019 10:44:55 -0700 (PDT) Received: from lylat ([2604:3d09:e37f:1500:1a72:4878:e793:7302]) by smtp.gmail.com with ESMTPSA id b2sm32225741pfo.150.2019.04.07.10.44.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 07 Apr 2019 10:44:54 -0700 (PDT) From: Alex To: Eli Zaretskii Subject: Re: bug#35179: [PATCH] Plug memory leak in GTK x-display-monitor-attributes-list References: <87a7h2z96i.fsf@gmail.com> <871s2dvpgf.fsf@gmail.com> <83wok593ny.fsf@gnu.org> <87wok5u3bv.fsf@gmail.com> Date: Sun, 07 Apr 2019 11:44:54 -0600 In-Reply-To: <87wok5u3bv.fsf@gmail.com> (Alex's message of "Sun, 07 Apr 2019 11:34:28 -0600") Message-ID: <87sgutu2uh.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 35179 Cc: 35179@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Whoops, I forgot to add a closing parenthesis... --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Plug-memory-leak-in-GTK-x-display-monitor-attributes.patch Content-Description: v2.000001 >From eca698eaf5404071e90505d195c5237739f244db Mon Sep 17 00:00:00 2001 From: Alexander Gramiak Date: Sat, 6 Apr 2019 23:02:24 -0600 Subject: [PATCH] Plug memory leak in GTK x-display-monitor-attributes-list * src/frame.c (free_monitors) [USE_GTK]: Define in the GTK case as well. * src/xfns.c (x-display-monitor-attributes-list) [USE_GTK]: Plug memory leak. * src/frame.h (MonitorInfo): Declare name as pointing to const char. --- src/frame.c | 4 ++-- src/frame.h | 2 +- src/xfns.c | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/frame.c b/src/frame.c index d0c77149ba..6fdb7d0cbb 100644 --- a/src/frame.c +++ b/src/frame.c @@ -5662,8 +5662,8 @@ selected frame. This is useful when `make-pointer-invisible' is set. */) #ifdef HAVE_WINDOW_SYSTEM -# if (defined HAVE_NS \ - || (!defined USE_GTK && (defined HAVE_XINERAMA || defined HAVE_XRANDR))) +# if (defined USE_GTK || defined HAVE_NS || defined HAVE_XINERAMA \ + || defined HAVE_XRANDR) void free_monitors (struct MonitorInfo *monitors, int n_monitors) { diff --git a/src/frame.h b/src/frame.h index ed62e7ace0..b1eedf36a3 100644 --- a/src/frame.h +++ b/src/frame.h @@ -1648,7 +1648,7 @@ flush_frame (struct frame *f) struct MonitorInfo { XRectangle geom, work; int mm_width, mm_height; - char *name; + const char *name; }; extern void free_monitors (struct MonitorInfo *monitors, int n_monitors); diff --git a/src/xfns.c b/src/xfns.c index f238a3daa1..33595afc1e 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -5041,6 +5041,7 @@ Internal use only, use `display-monitor-attributes-list' instead. */) primary_monitor, monitor_frames, source); + free_monitors (monitors, n_monitors); unblock_input (); #else /* not USE_GTK */ -- 2.21.0 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sun Apr 07 14:21:36 2019 Received: (at 35179) by debbugs.gnu.org; 7 Apr 2019 18:21:37 +0000 Received: from localhost ([127.0.0.1]:48679 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hDCQC-0001uV-KB for submit@debbugs.gnu.org; Sun, 07 Apr 2019 14:21:36 -0400 Received: from eggs.gnu.org ([209.51.188.92]:57652) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hDCQA-0001uG-SG for 35179@debbugs.gnu.org; Sun, 07 Apr 2019 14:21:35 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:57809) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hDCQ5-0004Lb-5g; Sun, 07 Apr 2019 14:21:29 -0400 Received: from [176.228.60.248] (port=3198 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1hDCQ3-0007lb-Jm; Sun, 07 Apr 2019 14:21:29 -0400 Date: Sun, 07 Apr 2019 21:21:20 +0300 Message-Id: <83sgut8yn3.fsf@gnu.org> From: Eli Zaretskii To: Alex In-reply-to: <87sgutu2uh.fsf@gmail.com> (message from Alex on Sun, 07 Apr 2019 11:44:54 -0600) Subject: Re: bug#35179: [PATCH] Plug memory leak in GTK x-display-monitor-attributes-list References: <87a7h2z96i.fsf@gmail.com> <871s2dvpgf.fsf@gmail.com> <83wok593ny.fsf@gnu.org> <87wok5u3bv.fsf@gmail.com> <87sgutu2uh.fsf@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 35179 Cc: 35179@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) > From: Alex > Cc: 35179@debbugs.gnu.org > Date: Sun, 07 Apr 2019 11:44:54 -0600 > > Whoops, I forgot to add a closing parenthesis... Thanks. This variant is fine with me, but since we use xfree to free the name, I think we should use xstrdup, not g_strdup, to copy it, as the latter is documented to need g_free to free the storage. From debbugs-submit-bounces@debbugs.gnu.org Sun Apr 07 14:52:55 2019 Received: (at 35179) by debbugs.gnu.org; 7 Apr 2019 18:52:55 +0000 Received: from localhost ([127.0.0.1]:48698 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hDCuV-0002dk-IJ for submit@debbugs.gnu.org; Sun, 07 Apr 2019 14:52:55 -0400 Received: from mail-pl1-f173.google.com ([209.85.214.173]:35530) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hDCuS-0002dK-Js; Sun, 07 Apr 2019 14:52:53 -0400 Received: by mail-pl1-f173.google.com with SMTP id w24so6019264plp.2; Sun, 07 Apr 2019 11:52:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=1xVzQG/Ilcg6Otsw/Yz9iw0OmzSZWKWsVSsi3bpj8Co=; b=MipZrgjnYXkcn4Laf3lQCTfr3EYkVDI9DBRujj57dxCYIrGKZbc6sVuMyMIXzkLGXD c1b+hsp7iJiKSpfeiZbrerNyIFY9dSD9AWChqbpQcM9KtWlDpJLaSGnUMFcTygM3cDNK vyjF2O/K+PxroLpsdHsVXmZC7AOMmNRRx6VaUnKWmA9AmNkbhAT3cvJ6j782W2WkTs4A pf1GulIKsb9i029m1w6+zQRGOtHzZkk4rRJ8VEephJfHtEHH70KB9q3/AIuur/54wTEb S8f8ltScF+MhR5pkfaTcojmZFI7NCPlTSQLpetIo777H0DWqsK4ajtT4jo4EmrZM8aY/ Udpg== 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:references:date:in-reply-to :message-id:user-agent:mime-version; bh=1xVzQG/Ilcg6Otsw/Yz9iw0OmzSZWKWsVSsi3bpj8Co=; b=X31g9C+aerHZjjTQNnNdhqSWqAm6IapM8sGa2NMt2G3xh23thTQddxFrs7ilgbsNti RsTx32CECFpX5BWVddOJWxBcc3gqVawyd9TX+lbiSXPqaqOWnQaL2FE5CD+UiQV9k4ir pGDujtKMGCl51ctAuSUbZFLaX4E1tJXcqMWA/i6999I5Gq0iMd7JP/P4dFGRdBY+huqJ E5utJmcZjV98cqkzNLNeZny0iijvzIbkqJRiqqsqOUhykEySOn7Nk7zmSuVG7S5Tym/c nxme1RXwsCd+KJAR66sVgI7VWPwyh19+6Q+WJ0ODF/FfYVVvwmMOSPZdmp4C00HHGa9a hhEg== X-Gm-Message-State: APjAAAW6x/aLI5IvzIaWGfgW7uXCss8QYgxko+796T/WlH6ltiLdQFWs vUmhh6HCx//4JsWFaEdA36tAn+t0 X-Google-Smtp-Source: APXvYqxXFxjhxLC1Q3JY+ZXiolwYaRxyZ1+ODbBIstr9Ls7vJpCs8TUFTZMINVghH4ofb6UCUtjqgw== X-Received: by 2002:a17:902:2a89:: with SMTP id j9mr25985301plb.272.1554663166131; Sun, 07 Apr 2019 11:52:46 -0700 (PDT) Received: from lylat ([2604:3d09:e37f:1500:1a72:4878:e793:7302]) by smtp.gmail.com with ESMTPSA id 129sm15691668pgc.24.2019.04.07.11.52.44 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 07 Apr 2019 11:52:45 -0700 (PDT) From: Alex To: Eli Zaretskii Subject: Re: bug#35179: [PATCH] Plug memory leak in GTK x-display-monitor-attributes-list References: <87a7h2z96i.fsf@gmail.com> <871s2dvpgf.fsf@gmail.com> <83wok593ny.fsf@gnu.org> <87wok5u3bv.fsf@gmail.com> <87sgutu2uh.fsf@gmail.com> <83sgut8yn3.fsf@gnu.org> Date: Sun, 07 Apr 2019 12:52:45 -0600 In-Reply-To: <83sgut8yn3.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 07 Apr 2019 21:21:20 +0300") Message-ID: <87imvptzpe.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 35179 Cc: 35179@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) close 35179 quit Eli Zaretskii writes: >> From: Alex >> Cc: 35179@debbugs.gnu.org >> Date: Sun, 07 Apr 2019 11:44:54 -0600 >> >> Whoops, I forgot to add a closing parenthesis... > > Thanks. This variant is fine with me, but since we use xfree to free > the name, I think we should use xstrdup, not g_strdup, to copy it, as > the latter is documented to need g_free to free the storage. Okay, I pushed it as a35e06bbe2. I also added in a GTK version check since `name' isn't used if !GTK_CHECK_VERSION(2, 14, 0). From unknown Fri Jun 20 07:16:17 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 06 May 2019 11:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator