From: AndyZhou Date: Mon, 13 Dec 2021 03:41:25 +0000 (+0800) Subject: agl-compositor:Add NULL check after zalloc in screenshooter.c X-Git-Tag: 12.91.0~1 X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=commitdiff_plain;h=18918978ba5c0f91f05513170c8ca57a93e96722;p=src%2Fagl-compositor.git agl-compositor:Add NULL check after zalloc in screenshooter.c There's no NULL check in zalloc. xdg_output is alloced by zalloc. Add a NULL check after zalloc and before use xdg_output. Bug-AGL: SPEC-4178 Signed-off-by: ZhouMingying Change-Id: Idc2e3fd6be823c063a84868ba37b26ffe90db6fc --- diff --git a/clients/screenshooter.c b/clients/screenshooter.c index 64dc76a..8c2b553 100644 --- a/clients/screenshooter.c +++ b/clients/screenshooter.c @@ -201,6 +201,8 @@ add_xdg_output_v1_info(struct screenshooter_data *shooter_data, struct screenshooter_output *output) { struct xdg_output_v1_info *xdg_output = zalloc(sizeof(*xdg_output)); + if (!xdg_output) + return; wl_list_insert(&shooter_data->xdg_output_list, &xdg_output->link);