From 6ba20772aeaa4a2ca9fe58e34adf27513b8be981 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96man?= Date: Wed, 10 Jun 2009 06:09:55 +0000 Subject: [PATCH] Fix memory leak (startup only) --- src/htsp.c | 4 +++- src/http.c | 3 ++- src/xmltv.c | 8 ++++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/htsp.c b/src/htsp.c index f0969460..12b2966c 100644 --- a/src/htsp.c +++ b/src/htsp.c @@ -41,6 +41,8 @@ #include "htsmsg_binary.h" +static void *htsp_server; + #define HTSP_PROTO_VERSION 2 #define HTSP_PRIV_MASK (ACCESS_STREAMING) @@ -898,7 +900,7 @@ htsp_serve(int fd, void *opaque, struct sockaddr_in *source) void htsp_init(void) { - tcp_server_create(9982, htsp_serve, NULL); + htsp_server = tcp_server_create(9982, htsp_serve, NULL); } /** diff --git a/src/http.c b/src/http.c index 8953e221..e7d6944f 100644 --- a/src/http.c +++ b/src/http.c @@ -36,6 +36,7 @@ #include "http.h" #include "access.h" +static void *http_server; static LIST_HEAD(, http_path) http_paths; @@ -779,5 +780,5 @@ http_serve(int fd, void *opaque, struct sockaddr_in *source) void http_server_init(void) { - tcp_server_create(9981, http_serve, NULL); + http_server = tcp_server_create(9981, http_serve, NULL); } diff --git a/src/xmltv.c b/src/xmltv.c index 7d5212c2..fb2b7f7a 100644 --- a/src/xmltv.c +++ b/src/xmltv.c @@ -34,7 +34,6 @@ #include "xmltv.h" #include "spawn.h" - /** * */ @@ -517,13 +516,18 @@ void xmltv_init(void) { pthread_t ptid; + + pthread_attr_t attr; + pthread_attr_init(&attr); + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + xmltv_grab_interval = 12; /* Default half a day */ xmltv_grab_enabled = 1; /* Default on */ /* Load all channels */ xmltv_load(); - pthread_create(&ptid, NULL, xmltv_thread, NULL); + pthread_create(&ptid, &attr, xmltv_thread, NULL); }