summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorPatrik Flykt <patrik.flykt@linux.intel.com>2012-12-21 14:10:33 +0200
committerPatrik Flykt <patrik.flykt@linux.intel.com>2012-12-21 15:09:00 +0200
commit57279cee13fc3f3b43bf3c144e5be3a530c6d87e (patch)
tree2c54a543cd2e667c1c576da0df4297f3a442c029 /plugins
parent3a032dab10bf096b7b286963e11cd992df0c9ad5 (diff)
downloadconnman-57279cee13fc3f3b43bf3c144e5be3a530c6d87e.tar.gz
connman-57279cee13fc3f3b43bf3c144e5be3a530c6d87e.tar.bz2
connman-57279cee13fc3f3b43bf3c144e5be3a530c6d87e.zip
session-policy-local: Check policy being non-NULL before using
When running unit/test-session the following happens if SELinux is disabled but --enable-session-policy-local is specified for ./configure: connmand[6468]: src/session.c:__connman_session_create() owner :1.269 connmand[6468]: src/dbus.c:selinux_get_context_reply() Failed to retrieve SELinux context connmand[6468]: src/session.c:session_create_cb() session 0x2388dc0 config (nil) connmand[6468]: Aborting (signal 11) [src/connmand] connmand[6468]: ++++++++ backtrace ++++++++ connmand[6468]: #0 0x7f5b2b8184f0 in /lib/x86_64-linux-gnu/libc.so.6 connmand[6468]: #1 0x4379b4 in policy_local_destroy() at plugins/session_policy_local.c:245 connmand[6468]: #2 0x46703f in free_session() at src/session.c:258 connmand[6468]: #3 0x468603 in session_create_cb() at src/session.c:1710 connmand[6468]: #4 0x4377e7 in selinux_context_reply() at plugins/session_policy_local.c:201 connmand[6468]: #5 0x461366 in selinux_get_context_reply() at src/dbus.c:475 connmand[6468]: #6 0x7f5b2c66b1ca in /lib/x86_64-linux-gnu/libdbus-1.so.3 connmand[6468]: #7 0x7f5b2c66e293 in /lib/x86_64-linux-gnu/libdbus-1.so.3 connmand[6468]: #8 0x410aa8 in message_dispatch() at gdbus/mainloop.c:76 connmand[6468]: #9 0x7f5b2c8eeeeb in /lib/x86_64-linux-gnu/libglib-2.0.so.0 connmand[6468]: #10 0x7f5b2c8ee355 in /lib/x86_64-linux-gnu/libglib-2.0.so.0 connmand[6468]: #11 0x7f5b2c8ee688 in /lib/x86_64-linux-gnu/libglib-2.0.so.0 connmand[6468]: #12 0x7f5b2c8eea82 in /lib/x86_64-linux-gnu/libglib-2.0.so.0 connmand[6468]: #13 0x410592 in main() at src/main.c:672 connmand[6468]: #14 0x7f5b2b804ead in /lib/x86_64-linux-gnu/libc.so.6 connmand[6468]: +++++++++++++++++++++++++++
Diffstat (limited to 'plugins')
-rw-r--r--plugins/session_policy_local.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/plugins/session_policy_local.c b/plugins/session_policy_local.c
index 11b16652..5a8f6b8e 100644
--- a/plugins/session_policy_local.c
+++ b/plugins/session_policy_local.c
@@ -241,9 +241,11 @@ static void policy_local_destroy(struct connman_session *session)
DBG("session %p", session);
policy = g_hash_table_lookup(session_hash, session);
+ if (policy == NULL)
+ return;
+
g_hash_table_remove(session_hash, session);
policy->session = NULL;
-
policy_unref(policy);
}