#include "pdispatch.h"
#include "native-common.h"
+#include "xmalloc.h"
/*#define DEBUG_OPCODES*/
if (r->next)
r->next->previous = r->previous;
- free(r);
+ pa_xfree(r);
}
struct pa_pdispatch* pa_pdispatch_new(struct pa_mainloop_api *mainloop, const struct pa_pdispatch_command*table, unsigned entries) {
assert((entries && table) || (!entries && !table));
- pd = malloc(sizeof(struct pa_pdispatch));
- assert(pd);
+ pd = pa_xmalloc(sizeof(struct pa_pdispatch));
pd->mainloop = mainloop;
pd->command_table = table;
pd->n_commands = entries;
while (pd->replies)
reply_info_free(pd->replies);
- free(pd);
+ pa_xfree(pd);
}
int pa_pdispatch_run(struct pa_pdispatch *pd, struct pa_packet*packet, void *userdata) {
struct timeval tv;
assert(pd && cb);
- r = malloc(sizeof(struct reply_info));
- assert(r);
+ r = pa_xmalloc(sizeof(struct reply_info));
r->pdispatch = pd;
r->callback = cb;
r->userdata = userdata;