From c7c6f38c144142563e135eceb5daed492c203a85 Mon Sep 17 00:00:00 2001 From: Louis Burda Date: Fri, 25 Jun 2021 01:51:22 +0200 Subject: fix free() of potentially uninitialized pointer and minor refactors in service --- service/src/util.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'service/src/util.h') diff --git a/service/src/util.h b/service/src/util.h index d15fefa..4d2998d 100644 --- a/service/src/util.h +++ b/service/src/util.h @@ -11,10 +11,12 @@ #define MIN(x,y) ((x) > (y) ? (y) : (x)) #define MAX(x,y) ((x) < (y) ? (y) : (x)) +#define PRINTABLE(c) ((c) >= 32 ? (c) : ' ') + #define ERR(...) printf("ERR: " __VA_ARGS__) -#define NFREE(p) do { free(p); p = NULL; } while (0) -#define NFCLOSE(f) do { fclose(f); f = NULL; } while (0) +#define FREE(p) do { free(p); p = NULL; } while (0) +#define FCLOSE(f) do { if (f) fclose(f); f = NULL; } while (0) #define MHASHLEN 40 -- cgit v1.2.3-71-gd317