aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2026-04-28 15:28:25 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2026-04-28 15:28:25 -0400
commite99e2cfc497438fee72a3c799aba2a988a650c66 (patch)
treed038edbee63f5edf96bad74c34169781f7f873cd /src
parent10f13b36560c5112554c54d8958081b7aa518050 (diff)
downloadstasis-e99e2cfc497438fee72a3c799aba2a988a650c66.tar.gz
call va_end
Diffstat (limited to 'src')
-rw-r--r--src/lib/core/utils.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/lib/core/utils.c b/src/lib/core/utils.c
index 90dac1d..f8fcadb 100644
--- a/src/lib/core/utils.c
+++ b/src/lib/core/utils.c
@@ -420,26 +420,28 @@ char *git_rev_parse(const char *path, char *args) {
}
void msg(unsigned type, char *fmt, ...) {
+ va_list args;
+ va_start(args, fmt);
+
FILE *stream = NULL;
char header[255];
char status[20];
if (type & STASIS_MSG_NOP) {
// quiet mode
+ va_end(args);
return;
}
if (!globals.verbose && type & STASIS_MSG_RESTRICT) {
// Verbose mode is not active
+ va_end(args);
return;
}
memset(header, 0, sizeof(header));
memset(status, 0, sizeof(status));
- va_list args;
- va_start(args, fmt);
-
stream = stdout;
fprintf(stream, "%s", STASIS_COLOR_RESET);
if (type & STASIS_MSG_ERROR) {
@@ -467,17 +469,20 @@ void msg(unsigned type, char *fmt, ...) {
if (fprintf(stream, "%s", header) < 0) {
SYSERROR("%s", "unable to write message header to stream");
+ va_end(args);
return;
}
const int len = vfprintf(stream, fmt, args);
if (len < 0) {
SYSERROR("%s", "unable to write message to stream");
+ va_end(args);
return;
}
if (fprintf(stream, "%s", STASIS_COLOR_RESET) < 0) {
SYSERROR("%s", "unable to write message footer to stream");
+ va_end(args);
return;
}
va_end(args);