Checking for NULL before dereferencing the wl_event_source
pointer so as to avoid crash.

Signed-off-by: Srivardhan Hebbar <sri.heb...@samsung.com>
---
 src/event-loop.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/event-loop.c b/src/event-loop.c
index 9790cde..b62d16e 100644
--- a/src/event-loop.c
+++ b/src/event-loop.c
@@ -312,7 +312,12 @@ wl_event_source_check(struct wl_event_source *source)
 WL_EXPORT int
 wl_event_source_remove(struct wl_event_source *source)
 {
-       struct wl_event_loop *loop = source->loop;
+       struct wl_event_loop *loop;
+
+       if (source == NULL)
+               return 0;
+
+       loop = source->loop;
 
        /* We need to explicitly remove the fd, since closing the fd
         * isn't enough in case we've dup'ed the fd. */
-- 
1.7.9.5

_______________________________________________
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to