Fix Static analysis warning.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
NADAL Jean-Baptiste
2020-02-20 12:32:56 +01:00
parent d01399dd7f
commit c6cdd21512
5 changed files with 16 additions and 5 deletions

View File

@@ -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")

View File

@@ -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 <string.h>
@@ -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;
}

View File

@@ -1,5 +1,5 @@
/*!
* rest_handler.c
* rest_server.c
*
* Copyright (c) 2015-2020, NADAL Jean-Baptiste. All rights reserved.
*

View File

@@ -28,7 +28,7 @@
/*------------------------------- INCLUDES ----------------------------------*/
#include <rest/restd.h>
#include <restd.h>
extern int setup_rest_server(restd_server_t *rest_server, const char *port, const char *root_path, void *dm);

View File

@@ -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 <fcntl.h>
@@ -34,7 +37,7 @@
#include <curl/curl.h>
#include <rest/restd.h>
#include <restd.h>
#include "qunit.h"