u->mainloop_source = c->mainloop->source_io(c->mainloop, u->fd, (u->source ? PA_MAINLOOP_API_IO_EVENT_INPUT : 0) | (u->sink ? PA_MAINLOOP_API_IO_EVENT_OUTPUT : 0), io_callback, u);
assert(u->mainloop_source);
+ pa_modargs_free(ma);
+
return 0;
fail:
pa_module_done(c, m);
+ if (ma)
+ pa_modargs_free(ma);
+
return -1;
}
int pa_module_init(struct pa_core *c, struct pa_module*m) {
struct pa_socket_server *s;
- struct pa_modargs *ma;
+ struct pa_modargs *ma = NULL;
+ int ret = -1;
assert(c && m);
if (!(ma = pa_modargs_new(m->argument, valid_modargs))) {
fprintf(stderr, "Failed to parse module arguments\n");
- return -1;
+ goto finish;
}
if (!(s = create_socket_server(c, ma)))
- return -1;
+ goto finish;
if (!(m->userdata = protocol_new(c, s, m, ma))) {
pa_socket_server_free(s);
- return -1;
+ goto finish;
}
- return 0;
+ ret = 0;
+
+finish:
+ if (ma)
+ pa_modargs_free(ma);
+
+ return ret;
}
void pa_module_done(struct pa_core *c, struct pa_module*m) {