Commit d908b292 authored by Julien Nabet's avatar Julien Nabet Committed by Erik de Castro Lopo
Browse files

Fix some cppcheck reports



* src/libFLAC/metadata_iterators.c:3247: (error) va_list `va` was opened
  but not closed with va_end().
* src/share/grabbag/snprintf.c:66: (error) va_list `va` was opened but
  not closed with va_end().
* src/utils/flactimer/main.cpp:84: (warning) Either the condition `!fout`
  is redundant or there is possible null pointer dereference.
Signed-off-by: Erik de Castro Lopo's avatarErik de Castro Lopo <erikd@mega-nerd.com>
Closes: https://github.com/xiph/flac/pull/8
parent 293d6b22
......@@ -3240,11 +3240,14 @@ local_snprintf(char *str, size_t size, const char *fmt, ...)
va_list va;
int rc;
va_start (va, fmt);
#if defined _MSC_VER
if (size == 0)
return 1024;
#endif
va_start (va, fmt);
#if defined _MSC_VER
rc = vsnprintf_s (str, size, _TRUNCATE, fmt, va);
if (rc < 0)
rc = size - 1;
......
......@@ -59,11 +59,14 @@ flac_snprintf(char *str, size_t size, const char *fmt, ...)
va_list va;
int rc;
va_start (va, fmt);
#if defined _MSC_VER
if (size == 0)
return 1024;
#endif
va_start (va, fmt);
#if defined _MSC_VER
rc = vsnprintf_s (str, size, _TRUNCATE, fmt, va);
if (rc < 0)
rc = size - 1;
......
......@@ -81,7 +81,7 @@ int main(int argc, char *argv[])
}
fout = fopen(argv[1], "w");
if(!fout) {
fprintf(fout, "ERROR opening file %s for writing\n", argv[1]);
fprintf(stderr, "ERROR opening file %s for writing\n", argv[1]);
return 1;
}
argv += 2;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment