Allocate memory with apr_palloc instead of malloc.