elput: Missing pointer initialization.
authorBenjamin Jacobs <benj@spam.thsi.be>
Tue, 7 Jun 2016 13:42:49 +0000 (09:42 -0400)
committerChris Michael <cpmichael@osg.samsung.com>
Tue, 7 Jun 2016 13:43:01 +0000 (09:43 -0400)
Summary:
Calling free() on an uninitialized pointer leads to crash, that can occurs
when sd_session_get_seat fails.
Fixes T3785.

Reviewers: devilhorns

Subscribers: cedric, jpeg

Maniphest Tasks: T3785

Differential Revision: https://phab.enlightenment.org/D4015

@fix

src/lib/elput/elput_logind.c

index 22cb1b0..799a26a 100644 (file)
@@ -427,7 +427,7 @@ _logind_connect(Elput_Manager **manager, const char *seat, unsigned int tty)
    if (ret < 0)
      {
         ERR("Failed to get session seat");
-        free(s);
+        if (s) free(s);
         goto seat_err;
      }
    else if ((seat) && (s) && (strcmp(seat, s)))