summaryrefslogtreecommitdiffstats
path: root/sdpd
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2007-01-20 20:42:27 +0000
committerMarcel Holtmann <marcel@holtmann.org>2007-01-20 20:42:27 +0000
commit7899df370a9395fe016f54a311e58487be04c66c (patch)
treebc928f0d20213fc4daa6d89a8d4e0d819b4233b4 /sdpd
parenteeb436f3b83e749dd9d7ae1c123765188155aa9c (diff)
Fix memory leaks
Diffstat (limited to 'sdpd')
-rw-r--r--sdpd/server.c2
-rw-r--r--sdpd/service.c8
-rw-r--r--sdpd/servicedb.c8
3 files changed, 14 insertions, 4 deletions
diff --git a/sdpd/server.c b/sdpd/server.c
index c5458aac..4316746b 100644
--- a/sdpd/server.c
+++ b/sdpd/server.c
@@ -211,6 +211,8 @@ static gboolean io_accept_event(GIOChannel *chan, GIOCondition cond, gpointer da
g_io_add_watch(io, G_IO_IN, io_session_event, data);
+ g_io_channel_unref(io);
+
return TRUE;
}
diff --git a/sdpd/service.c b/sdpd/service.c
index 0b4b0d8e..83844d68 100644
--- a/sdpd/service.c
+++ b/sdpd/service.c
@@ -353,11 +353,15 @@ int service_register_req(sdp_req_t *req, sdp_buf_t *rsp)
if (rec->handle == 0xffffffff) {
rec->handle = sdp_next_handle();
- if (rec->handle < 0x10000)
+ if (rec->handle < 0x10000) {
+ sdp_record_free(rec);
goto invalid;
+ }
} else {
- if (sdp_record_find(rec->handle))
+ if (sdp_record_find(rec->handle)) {
+ sdp_record_free(rec);
goto invalid;
+ }
}
sdp_record_add(&req->device, rec);
diff --git a/sdpd/servicedb.c b/sdpd/servicedb.c
index decc2e65..8f5ff810 100644
--- a/sdpd/servicedb.c
+++ b/sdpd/servicedb.c
@@ -244,14 +244,18 @@ int sdp_record_remove(uint32_t handle)
}
r = (sdp_record_t *) p->data;
- if (r)
+ if (r) {
service_db = sdp_list_remove(service_db, r);
+ sdp_record_free(r);
+ }
p = access_locate(handle);
if (p) {
a = (sdp_access_t *) p->data;
- if (a)
+ if (a) {
access_db = sdp_list_remove(access_db, a);
+ access_free(a);
+ }
}
return 0;