From f6d6204aba7ef933f2b8870953f2926c3123a6e4 Mon Sep 17 00:00:00 2001 From: smitsohu Date: Sat, 11 Aug 2018 21:59:59 +0200 Subject: clear all warnings from cppcheck static code analysis obtained with: cppcheck --enable=warning --force --inconclusive --quiet ~/firejail/src --- src/libtracelog/libtracelog.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/libtracelog') diff --git a/src/libtracelog/libtracelog.c b/src/libtracelog/libtracelog.c index 5ce41aca0..0f8d5a00d 100644 --- a/src/libtracelog/libtracelog.c +++ b/src/libtracelog/libtracelog.c @@ -64,9 +64,6 @@ static inline uint32_t hash(const char *str) { } static void storage_add(const char *str) { -#ifdef DEBUG - printf("add %s\n", str); -#endif if (!str) { #ifdef DEBUG printf("null pointer passed to storage_add\n"); @@ -74,6 +71,10 @@ static void storage_add(const char *str) { return; } +#ifdef DEBUG + printf("add %s\n", str); +#endif + ListElem *ptr = malloc(sizeof(ListElem)); if (!ptr) { fprintf(stderr, "Error: cannot allocate memory\n"); @@ -96,15 +97,17 @@ static void storage_add(const char *str) { static char* cwd = NULL; static char *storage_find(const char *str) { -#ifdef DEBUG - printf("storage find %s\n", str); -#endif if (!str) { #ifdef DEBUG printf("null pointer passed to storage_find\n"); #endif return NULL; } + +#ifdef DEBUG + printf("storage find %s\n", str); +#endif + const char *tofind = str; int allocated = 0; -- cgit v1.2.3-54-g00ecf