[gdm/wip/misc-fixes: 23/23] common: remove unnecessary free



commit c0c62e4c01a2c5481c537d57fd0c12ab067fb4b5
Author: Ray Strode <rstrode redhat com>
Date:   Thu Aug 30 13:04:56 2018 -0400

    common: remove unnecessary free
    
    This commit drops an erroneous free call, that would
    potentially free a dangling pointer.
    
    Luckily the error condition can never occur because the
    error code checked is never returned, so the free call
    is dead code.
    
    This commit removes the free call.  A subsequent commit
    will fix the error code checking.

 common/gdm-common.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
---
diff --git a/common/gdm-common.c b/common/gdm-common.c
index 871f9bfc..9683d557 100644
--- a/common/gdm-common.c
+++ b/common/gdm-common.c
@@ -408,10 +408,8 @@ gdm_get_login_window_session_id (const char  *seat_id,
 
                 res = sd_session_get_class (sessions[i], &service_class);
                 if (res < 0) {
-                        if (res == -ENOENT) {
-                                free (service_class);
+                        if (res == -ENOENT)
                                 continue;
-                        }
 
                         g_debug ("failed to determine class of session %s: %s", sessions[i], strerror 
(-res));
                         ret = FALSE;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]