After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 563427 - gui/simple-greeter/gdm-sessions.c:181: Memory leak: id
gui/simple-greeter/gdm-sessions.c:181: Memory leak: id
Status: RESOLVED FIXED
Product: gdm
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: Bruno Boaventura
GDM maintainers
Depends on:
Blocks:
 
 
Reported: 2008-12-06 10:58 UTC by aggro
Modified: 2008-12-08 20:07 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch that fixes this bug. (315 bytes, patch)
2008-12-06 13:00 UTC, Bruno Boaventura
accepted-commit_now Details | Review

Description aggro 2008-12-06 10:58:57 UTC
Svn revision 6623

In file gui/simple-greeter/gdm-sessions.c:181
Variable "id" seems to be leaking memory. Memory is allocated with g_strndup() but not freed anywhere. load_session_file() seems to just make copies of it. 

        while ((filename = g_dir_read_name (dir))) {
                char *id;
                char *full_path;

                if (! g_str_has_suffix (filename, ".desktop")) {
                        continue;
                }
                id = g_strndup (filename, strlen (filename) - strlen (".desktop"));

                full_path = g_build_filename (dirname, filename, NULL);

                load_session_file (id, full_path);

                g_free (full_path);
        }

Leak was found using cppcheck: http://cppcheck.wiki.sourceforge.net/
Comment 1 Bruno Boaventura 2008-12-06 13:00:19 UTC
Created attachment 124047 [details] [review]
patch that fixes this bug.
Comment 2 Ray Strode [halfline] 2008-12-08 15:58:41 UTC
thanks, feel free to commit
Comment 3 Bruno Boaventura 2008-12-08 20:07:36 UTC
Thanks, Ray!
Commited.
Comment 4 Bruno Boaventura 2008-12-08 20:07:52 UTC
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.