summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2004-07-15 17:33:56 +0000
committerLennart Poettering <lennart@poettering.net>2004-07-15 17:33:56 +0000
commited9bd5f01fca5e8d610b4884358e3dda47c9ab00 (patch)
tree9fd818c90830be830be114c84415369b68ae4014
parent1416fef19796fa5372e6ed02cfd18574a040255f (diff)
fix modargs memory leak
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@68 fefdeb5f-60dc-0310-8127-8f9354f1896f
-rw-r--r--src/module-oss-mmap.c5
-rw-r--r--src/module-oss.c2
-rw-r--r--src/module-protocol-stub.c17
-rw-r--r--src/todo2
4 files changed, 19 insertions, 7 deletions
diff --git a/src/module-oss-mmap.c b/src/module-oss-mmap.c
index 020daa2c..ceaae493 100644
--- a/src/module-oss-mmap.c
+++ b/src/module-oss-mmap.c
@@ -306,11 +306,16 @@ int pa_module_init(struct pa_core *c, struct pa_module*m) {
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;
}
diff --git a/src/module-oss.c b/src/module-oss.c
index 5a6513c3..48d10486 100644
--- a/src/module-oss.c
+++ b/src/module-oss.c
@@ -229,6 +229,8 @@ int pa_module_init(struct pa_core *c, struct pa_module*m) {
m->userdata = u;
+ pa_modargs_free(ma);
+
return 0;
fail:
diff --git a/src/module-protocol-stub.c b/src/module-protocol-stub.c
index 4f82d4e0..7338abc9 100644
--- a/src/module-protocol-stub.c
+++ b/src/module-protocol-stub.c
@@ -107,23 +107,30 @@ struct pa_socket_server *create_socket_server(struct pa_core *c, struct pa_modar
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) {
diff --git a/src/todo b/src/todo
index 2bec6f18..5e90dfda 100644
--- a/src/todo
+++ b/src/todo
@@ -1,5 +1,3 @@
-- modargs memory leak
-
- clean secure directory handling (with username)
- native library/protocol: