unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Alex <agrambot@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 35179@debbugs.gnu.org
Subject: bug#35179: [PATCH] Plug memory leak in GTK	x-display-monitor-attributes-list
Date: Sun, 07 Apr 2019 11:44:54 -0600	[thread overview]
Message-ID: <87sgutu2uh.fsf@gmail.com> (raw)
In-Reply-To: <87wok5u3bv.fsf@gmail.com> (Alex's message of "Sun, 07 Apr 2019 11:34:28 -0600")

[-- Attachment #1: Type: text/plain, Size: 50 bytes --]

Whoops, I forgot to add a closing parenthesis...


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: v2.000001 --]
[-- Type: text/x-patch, Size: 1936 bytes --]

From eca698eaf5404071e90505d195c5237739f244db Mon Sep 17 00:00:00 2001
From: Alexander Gramiak <agrambot@gmail.com>
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


  reply	other threads:[~2019-04-07 17:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-07  5:16 bug#35179: [PATCH] Plug memory leak in GTK x-display-monitor-attributes-list Alex
2019-04-07  6:37 ` Eli Zaretskii
2019-04-07 14:51   ` Alex
2019-04-07 16:32     ` Eli Zaretskii
2019-04-07 17:34       ` Alex
2019-04-07 17:44         ` Alex [this message]
2019-04-07 18:21           ` Eli Zaretskii
2019-04-07 18:52             ` Alex

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87sgutu2uh.fsf@gmail.com \
    --to=agrambot@gmail.com \
    --cc=35179@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).