From: Pavel TvrdĂ­k Date: Tue, 29 Mar 2016 08:37:31 +0000 (+0200) Subject: Clearness of code of usage variable argument lists X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=51e8192c4c8694a31253d4604ae1df0dc0c4ed06;p=thirdparty%2Fbird.git 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. --- diff --git a/client/util.c b/client/util.c index 050224b97..826cd48d6 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 b4474ce66..54a87d12a 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 7cb26360a..5cd15156b 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); }