summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2007-01-21 18:57:15 +0000
committerMarcel Holtmann <marcel@holtmann.org>2007-01-21 18:57:15 +0000
commitf274c01bde0e88ee7aa86f0197ad59b125930ad4 (patch)
tree64b7df3906e2df77bb3b6f2aa8e8a0e6636b8d23
parent84dc067ee69533534a9e79359f17ab337f2a37e1 (diff)
Fix cleanup in case the SDP server startup fails
-rw-r--r--sdpd/server.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sdpd/server.c b/sdpd/server.c
index 6e632237..3f29bbef 100644
--- a/sdpd/server.c
+++ b/sdpd/server.c
@@ -47,7 +47,7 @@
#include "logging.h"
#include "sdpd.h"
-static GIOChannel *l2cap_io, *unix_io;
+static GIOChannel *l2cap_io = NULL, *unix_io = NULL;
static int l2cap_sock, unix_sock;
@@ -237,8 +237,7 @@ int start_sdp_server(uint16_t mtu, uint32_t flags)
g_io_channel_set_close_on_unref(unix_io, TRUE);
g_io_add_watch(unix_io, G_IO_IN, io_accept_event, &unix_sock);
- } else
- unix_io = NULL;
+ }
return 0;
}
@@ -252,5 +251,6 @@ void stop_sdp_server(void)
if (unix_io)
g_io_channel_unref(unix_io);
- g_io_channel_unref(l2cap_io);
+ if (l2cap_io)
+ g_io_channel_unref(l2cap_io);
}