struct udebug_ptr *ptr;
uint32_t ofs;
uint32_t len;
+ va_list ap2;
char *str;
if (!hdr)
return -1;
str = udebug_buf_alloc(buf, ofs, UDEBUG_MIN_ALLOC_LEN);
- len = vsnprintf(str, UDEBUG_MIN_ALLOC_LEN, fmt, ap);
+ va_copy(ap2, ap);
+ len = vsnprintf(str, UDEBUG_MIN_ALLOC_LEN, fmt, ap2);
+ va_end(ap2);
if (len <= UDEBUG_MIN_ALLOC_LEN)
goto out;