From f987424ed9954239ec0a730b721700ac58c1bf1a Mon Sep 17 00:00:00 2001 From: "Rafael G. Martins" Date: Sun, 10 May 2015 23:10:10 -0300 Subject: fixed a few issues reported by clang's static analyzer --- src/utils/strings.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/utils/strings.c') diff --git a/src/utils/strings.c b/src/utils/strings.c index 04ccc7a..4a48f6d 100644 --- a/src/utils/strings.c +++ b/src/utils/strings.c @@ -6,6 +6,10 @@ * See the file COPYING. */ +#ifdef HAVE_CONFIG_H +#include +#endif /* HAVE_CONFIG_H */ + #include #include #include @@ -57,8 +61,10 @@ b_strdup_vprintf(const char *format, va_list ap) if (!tmp) return NULL; int l2 = vsnprintf(tmp, l + 1, format, ap); - if (l2 < 0) + if (l2 < 0) { + free(tmp); return NULL; + } return tmp; } -- cgit v1.2.3-18-g5258