]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
fix some memory leaks
authorTrujulu <trujulu@gmail.com>
Sun, 4 Jan 2026 15:18:30 +0000 (16:18 +0100)
committerFlole <Flole998@users.noreply.github.com>
Mon, 5 Jan 2026 15:56:48 +0000 (16:56 +0100)
-sbuf double initialization causes memory leak

-some missing variable destructions

src/api.c
src/htsmsg.c
src/input/mpegts/iptv/iptv_auto.c
src/input/mpegts/iptv/iptv_http.c

index 7e853aa952a095adb029701f017eff9caaa06f12..d86fbda01312b97c451242ee24c01a384744141b 100644 (file)
--- a/src/api.c
+++ b/src/api.c
@@ -46,6 +46,7 @@ api_register ( const api_hook_t *hook )
   t = RB_INSERT_SORTED(&api_hook_tree, api_skel, link, ah_cmp);
   if (t) {
     tvherror(LS_API, "trying to re-register subsystem");
+    free(api_skel);
   } else {
     SKEL_USED(api_skel);
   }
index 74a8a0300a13f6b8ba1f2bc3c446edcf34f7fd61..9a30af95e0496ee918f21a2ad12bfacecba7fbc7 100644 (file)
@@ -1154,8 +1154,10 @@ htsmsg_field_get_msg ( htsmsg_field_t *f, int islist )
         free((void*)f->hmf_str);
       }
       l = f->hmf_msg  = malloc(sizeof(htsmsg_t));
-      if (l == NULL)
+      if (l == NULL) {
+        htsmsg_destroy(m);
         return NULL;
+      }
       f->hmf_type     = m->hm_islist ? HMF_LIST : HMF_MAP;
       f->hmf_flags   |= HMF_ALLOCED;
       l->hm_islist    = m->hm_islist;
index 5d7f1f45c05f7bf04439d9fabaae3f4a973841cf..617df6b280bcf8bed83afce8c8015907a6614e55 100644 (file)
@@ -162,7 +162,7 @@ iptv_auto_network_process_m3u_item(iptv_network_t *in,
   }
 
   if (urlparse(url, &u))
-    return;
+    goto end;
   if (u.host == NULL || u.host[0] == '\0')
     goto end;
 
index d5289ece87f913b1db28d6c1e35785af0ab54f37..038e51b3d089be7d8a0e39c95bc61b291aeccdff 100644 (file)
@@ -598,7 +598,6 @@ iptv_http_start
   im->im_data = hp;
   sbuf_init(&hp->m3u_sbuf);
   sbuf_init(&hp->key_sbuf);
-  sbuf_init_fixed(&im->mm_iptv_buffer, IPTV_BUF_SIZE);
   iptv_input_mux_started(hp->mi, im, 1);
   http_client_register(hc);          /* register to the HTTP thread */
   r = http_client_simple(hc, u);