From 51e8192c4c8694a31253d4604ae1df0dc0c4ed06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Tvrd=C3=ADk?= Date: Tue, 29 Mar 2016 10:37:31 +0200 Subject: [PATCH] Clearness of code of usage variable argument lists All cases are exiting from BIRD, so the patch is a little useless, however it will be good for copiage of this code. --- client/util.c | 2 ++ conf/conf.c | 1 + sysdep/unix/log.c | 2 ++ 3 files changed, 5 insertions(+) diff --git a/client/util.c b/client/util.c index 050224b9..826cd48d 100644 --- a/client/util.c +++ b/client/util.c @@ -37,6 +37,7 @@ bug(const char *msg, ...) fputs("Internal error: ", stderr); vlog(msg, args); vfprintf(stderr, msg, args); + va_end(args); exit(1); } @@ -48,5 +49,6 @@ die(const char *msg, ...) va_start(args, msg); cleanup(); vlog(msg, args); + va_end(args); exit(1); } diff --git a/conf/conf.c b/conf/conf.c index b4474ce6..54a87d12 100644 --- a/conf/conf.c +++ b/conf/conf.c @@ -507,6 +507,7 @@ cf_error(const char *msg, ...) va_start(args, msg); if (bvsnprintf(buf, sizeof(buf), msg, args) < 0) strcpy(buf, ""); + va_end(args); new_config->err_msg = cfg_strdup(buf); new_config->err_lino = ifs->lino; new_config->err_file_name = ifs->file_name; diff --git a/sysdep/unix/log.c b/sysdep/unix/log.c index 7cb26360..5cd15156 100644 --- a/sysdep/unix/log.c +++ b/sysdep/unix/log.c @@ -208,6 +208,7 @@ bug(const char *msg, ...) va_start(args, msg); vlog(L_BUG[0], msg, args); + va_end(args); abort(); } @@ -225,6 +226,7 @@ die(const char *msg, ...) va_start(args, msg); vlog(L_FATAL[0], msg, args); + va_end(args); exit(1); }