- ha = kmem_alloc(sizeof (history_arg_t), KM_SLEEP);
- ha->ha_history_str = kmem_alloc(vsnprintf(NULL, 0, fmt, adx) + 1,
- KM_SLEEP);
-
- (void) vsprintf(ha->ha_history_str, fmt, adx);
-
+ ha = kmem_alloc(sizeof (history_arg_t), KM_PUSHPAGE);
+ va_copy(adx_copy, adx);
+ ha->ha_history_str = kmem_vasprintf(fmt, adx_copy);
+ va_end(adx_copy);