From: duna.oh Date: Fri, 12 Aug 2022 09:09:26 +0000 (+0900) Subject: tinyds-tdm: add null-check to prevent null pointer dereference X-Git-Tag: submit/tizen/20220818.083245~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=69904952bfe65e89cd19c159d6b46596c58f8839;p=platform%2Fcore%2Fuifw%2Flibds-tizen.git tinyds-tdm: add null-check to prevent null pointer dereference Change-Id: I8e62560f3fb7ebb6e828978d9d20b5c6d502b9b2 --- diff --git a/examples/tinyds-tdm.c b/examples/tinyds-tdm.c index 2fb1f0e..a7428f1 100644 --- a/examples/tinyds-tdm.c +++ b/examples/tinyds-tdm.c @@ -259,10 +259,16 @@ view_populate_pid(struct tinyds_view *view) { pid_t pid; struct wl_client *client = NULL; - struct ds_surface *surface = ds_xdg_surface_get_surface(view->xdg_surface); + struct ds_surface *surface; + + surface = ds_xdg_surface_get_surface(view->xdg_surface); + if (!surface) + return; + + client = wl_resource_get_client(ds_surface_get_wl_resource(surface)); + if (!client) + return; - if (surface) - client = wl_resource_get_client(ds_surface_get_wl_resource(surface)); wl_client_get_credentials(client, &pid, NULL, NULL); ds_inf("view pid(%u)", pid);