From 669cbcdb143f8a4813497c70b94c1436aefff534 Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Thu, 27 Dec 2018 20:47:29 +0000 Subject: [PATCH] Fix some static analyzer errors Signed-off-by: Yuxuan Shui --- src/log.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/log.c b/src/log.c index 9a82927..3d5ac5b 100644 --- a/src/log.c +++ b/src/log.c @@ -48,6 +48,10 @@ log_default_writev(struct log_target *tgt, const struct iovec *vec, int vcnt) { total += vec[i].iov_len; } + if (!total) { + // Nothing to write + return; + } char *buf = ccalloc(total, char); total = 0; for (int i = 0; i < vcnt; i++) {