Add clang-tidy target and fix problems

This commit is contained in:
Tobias Reisinger 2020-11-13 02:06:48 +01:00
parent fca35ade9e
commit f97b149376
25 changed files with 199 additions and 115 deletions

View file

@ -1,9 +1,11 @@
#include <bsd/string.h>
#include <cache.h>
#include <logger.h>
#include <sql/cache.h>
#include <models/macro_action.h>
#include <models/junction_tag.h>
#include <models/junction_relay_schedule.h>
#include <models/junction_tag.h>
#include <models/macro_action.h>
#include <sql/cache.h>
sqlite3 *cache_database;
@ -25,8 +27,14 @@ cache_get_value(char *key)
if (s == SQLITE_ROW)
{
const char *found_value = (const char *)sqlite3_column_text(stmt, 0);
result = (char*)malloc(sizeof(char) * (strlen(found_value) + 1));
strcpy(result, found_value);
size_t found_value_len = sqlite3_column_bytes(stmt, 0);
if(result)
{
free(result);
}
result = (char*)malloc(sizeof(char) * (found_value_len + 1));
strlcpy(result, found_value, found_value_len + 1);
}
else
{