Fix segfault 43/50743/1 accepted/tizen/mobile/20151102.055233 accepted/tizen/tv/20151102.055254 accepted/tizen/wearable/20151102.055313 submit/tizen/20151102.022928
authorSuchang Woo <suchang.woo@samsung.com>
Fri, 30 Oct 2015 12:45:09 +0000 (21:45 +0900)
committerSuchang Woo <suchang.woo@samsung.com>
Fri, 30 Oct 2015 12:51:23 +0000 (21:51 +0900)
seat can be NULL but it is used in _is_valid_switch_user_dbus_request()
without NULL check.

Signed-off-by: Suchang Woo <suchang.woo@samsung.com>
Change-Id: I56ab152b49230f862d5d83e82ac6eef4863deafe

src/daemon/tlm-dbus-observer.c

index 3569ce3..e1c0c40 100644 (file)
@@ -419,6 +419,7 @@ _is_valid_switch_user_dbus_request(
         TlmDbusRequest *dbus_request,
         TlmSeat *seat)
 {
+    g_return_val_if_fail (seat && TLM_IS_SEAT(seat), FALSE);
     gboolean ret = TRUE;
     gchar *occupying_username = tlm_seat_get_occupying_username(seat);
     if (0 == g_strcmp0(dbus_request->username,occupying_username)) {
@@ -489,8 +490,9 @@ _process_request (
             goto _finished;
         }
 
-        if (req->seat && req->seat != seat) {
-            g_object_unref(req->seat);
+        if (req->seat != seat) {
+            if (req->seat)
+                g_object_unref(req->seat);
             req->seat = seat;
             g_object_ref(req->seat);
         }