diff --git a/daemon/gdm-session-direct.c b/daemon/gdm-session-direct.c
index 7d5b560..310a2e5 100644
--- a/daemon/gdm-session-direct.c
+++ b/daemon/gdm-session-direct.c
@@ -516,6 +516,7 @@ get_session_command_for_file (const char *file,
                                          &full_path,
                                          G_KEY_FILE_NONE,
                                          &error);
+        g_free (full_path);
         if (! res) {
                 g_debug ("GdmSessionDirect: File '%s' not found: %s", file, error->message);
                 g_error_free (error);
@@ -778,7 +779,7 @@ gdm_session_direct_handle_username_changed (GdmSessionDirect *session,
                  session->priv->selected_user != NULL ? session->priv->selected_user : "<unset>",
                  (strlen (text)) ? text : "<unset>");
 
-        gdm_session_direct_select_user (GDM_SESSION (session), (strlen (text) > 0) ? g_strdup (text) : NULL);
+        gdm_session_direct_select_user (GDM_SESSION (session), (strlen (text) > 0) ? text : NULL);
 
         _gdm_session_selected_user_changed (GDM_SESSION (session), session->priv->selected_user);
 
@@ -2221,6 +2222,7 @@ gdm_session_direct_bypasses_xsession (GdmSessionDirect *session_direct)
                                          &full_path,
                                          G_KEY_FILE_NONE,
                                          &error);
+        g_free (full_path);
         if (! res) {
                 g_debug ("GdmSessionDirect: File '%s' not found: %s", filename, error->message);
                 goto out;
