]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
IPTV: m3u parser - fix wrong free
authorJaroslav Kysela <perex@perex.cz>
Fri, 30 Oct 2015 12:53:57 +0000 (13:53 +0100)
committerJaroslav Kysela <perex@perex.cz>
Fri, 30 Oct 2015 12:53:57 +0000 (13:53 +0100)
src/input/mpegts/iptv/iptv_http.c

index 799d0951c2631456538c57cfe719e08aa7d2f69e..3bf2c6ee2833787fc617536f157bbb4f98760de1 100644 (file)
@@ -133,7 +133,7 @@ iptv_http_complete
   ( http_client_t *hc )
 {
   iptv_mux_t *im = hc->hc_aux;
-  char *url, sbuf[512], *s, *p;
+  char *url, *url2, *s, *p;
   url_t u;
   int r;
 
@@ -153,13 +153,16 @@ iptv_http_complete
         *p = '\0';
       if (!urlparse(s, &u))
         goto invalid;
+      url2 = malloc(512);
+      url2[0] = '\0';
       if ((s = http_arg_get(&hc->hc_args, "Host")) != NULL) {
-        snprintf(sbuf, sizeof(sbuf), "%s://%s%s",
+        snprintf(url2, 512, "%s://%s%s",
                  hc->hc_ssl ? "https" : "http", s, url);
       } else if (im->mm_iptv_url_raw) {
-        snprintf(sbuf, sizeof(sbuf), "%s%s", s, url);
+        snprintf(url2, 512, "%s%s", s, url);
       }
-      url = sbuf;
+      free(url);
+      url = url2;
       urlinit(&u);
     }
     if (!urlparse(url, &u)) {