From 24f08fc5c07724730e4a1b1e5221b63920d8c669 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Tue, 14 Jul 2020 07:37:24 +0100 Subject: [PATCH] coverity: missing malloc return check This is only coming at vhost startup, for a server that's before we go busy with heap. But still, it should be checked. --- CMakeLists.txt | 2 +- plugins/protocol_lws_server_status.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f3d34331b..d0d3ea668 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -327,7 +327,7 @@ set(PACKAGE "libwebsockets") set(CPACK_PACKAGE_NAME "${PACKAGE}") set(CPACK_PACKAGE_VERSION_MAJOR "4") set(CPACK_PACKAGE_VERSION_MINOR "0") -set(CPACK_PACKAGE_VERSION_PATCH "20") +set(CPACK_PACKAGE_VERSION_PATCH "21") set(CPACK_PACKAGE_RELEASE 1) set(CPACK_GENERATOR "RPM") set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}") diff --git a/plugins/protocol_lws_server_status.c b/plugins/protocol_lws_server_status.c index d53e857a1..f1b3880ea 100644 --- a/plugins/protocol_lws_server_status.c +++ b/plugins/protocol_lws_server_status.c @@ -158,6 +158,8 @@ callback_lws_server_status(struct lws *wsi, enum lws_callback_reasons reason, v->period_s = 5; if (!strcmp(pvo->name, "filepath")) { fp = malloc(sizeof(*fp)); + if (!fp) + return -1; fp->next = NULL; lws_snprintf(&fp->filepath[0], sizeof(fp->filepath), "%s",