diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 6948171..ad8dd61 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -2,6 +2,8 @@ cmake_minimum_required (VERSION 3.0) project (librestd) +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) + if(DOMO_BUILD_TEST) add_definitions (-g -DBUILD_DEBUG) add_definitions("-fprofile-arcs -ftest-coverage") diff --git a/lib/src/restd.c b/lib/src/restd.c index d1fcc08..f74cb2a 100644 --- a/lib/src/restd.c +++ b/lib/src/restd.c @@ -23,6 +23,9 @@ * */ +// This is an independent project of an individual developer. Dear PVS-Studio, please check it. +// PVS-Studio Static Code Analyzer for C, C++, C#, and Java: http://www.viva64.com + /*------------------------------- INCLUDES ----------------------------------*/ #include @@ -513,8 +516,11 @@ char *restd_http_get_body(restd_resp_t *response) size_t len = evbuffer_get_length(buf); body = malloc(len + 1); - int ret = evbuffer_copyout(buf, body, len); - body[len] = '\0'; + if (body != NULL) + { + int ret = evbuffer_copyout(buf, body, len); + body[len] = '\0'; + } return body; } diff --git a/src/rest/rest_server.c b/src/rest/rest_server.c index b8f11d7..5ec3356 100644 --- a/src/rest/rest_server.c +++ b/src/rest/rest_server.c @@ -1,5 +1,5 @@ /*! - * rest_handler.c + * rest_server.c * * Copyright (c) 2015-2020, NADAL Jean-Baptiste. All rights reserved. * diff --git a/src/rest/rest_server.h b/src/rest/rest_server.h index 71be5b0..f65ae6e 100644 --- a/src/rest/rest_server.h +++ b/src/rest/rest_server.h @@ -28,7 +28,7 @@ /*------------------------------- INCLUDES ----------------------------------*/ -#include +#include extern int setup_rest_server(restd_server_t *rest_server, const char *port, const char *root_path, void *dm); diff --git a/src/tests/test_main.c b/src/tests/test_main.c index 90e7f72..b7f3f3b 100644 --- a/src/tests/test_main.c +++ b/src/tests/test_main.c @@ -23,6 +23,9 @@ * */ +// This is an independent project of an individual developer. Dear PVS-Studio, please check it. +// PVS-Studio Static Code Analyzer for C, C++, C#, and Java: http://www.viva64.com + /*------------------------------- INCLUDES ----------------------------------*/ #include @@ -34,7 +37,7 @@ #include -#include +#include #include "qunit.h"