Skip to content

Commit fc8f707

Browse files
committed
fix: add missing va_end() to printf()
Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
1 parent 8ea71e9 commit fc8f707

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

cores/arduino/Print.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -263,14 +263,18 @@ int Print::printf(const char *format, ...)
263263
{
264264
va_list ap;
265265
va_start(ap, format);
266-
return vdprintf((int)this, format, ap);
266+
int retval = vdprintf((int)this, format, ap);
267+
va_end(ap);
268+
return retval;
267269
}
268270

269271
int Print::printf(const __FlashStringHelper *format, ...)
270272
{
271273
va_list ap;
272274
va_start(ap, format);
273-
return vdprintf((int)this, (const char *)format, ap);
275+
int retval = vdprintf((int)this, (const char *)format, ap);
276+
va_end(ap);
277+
return retval;
274278
}
275279

276280
// Private Methods /////////////////////////////////////////////////////////////
@@ -441,4 +445,4 @@ size_t Print::printFloat(double number, uint8_t digits)
441445
}
442446

443447
return n;
444-
}
448+
}

0 commit comments

Comments
 (0)