const char *fmt, va_list ap)
{
scanner_t s;
+ va_list ap_copy;
json_t *value;
jsonp_error_init(error, "");
s.column = 0;
next_token(&s);
- value = pack(&s, &ap);
+ va_copy(ap_copy, ap);
+ value = pack(&s, &ap_copy);
+ va_end(ap_copy);
next_token(&s);
if(s.token) {
const char *fmt, va_list ap)
{
scanner_t s;
+ va_list ap_copy;
jsonp_error_init(error, "");
next_token(&s);
- if(unpack(&s, root, &ap))
+ va_copy(ap_copy, ap);
+ if(unpack(&s, root, &ap_copy)) {
+ va_end(ap_copy);
return -1;
+ }
+ va_end(ap_copy);
next_token(&s);
if(s.token) {