]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
filebundle: reverse changes made in PR283 release/3.4 304/head 3.4patch1
authorAdam Sutton <dev@adamsutton.me.uk>
Fri, 5 Jul 2013 08:33:49 +0000 (09:33 +0100)
committerAdam Sutton <dev@adamsutton.me.uk>
Thu, 11 Jul 2013 19:17:34 +0000 (20:17 +0100)
The zlib input buffer is not defined const, therefore the extra malloc/memcpy
is required.
(cherry picked from commit 595623391773378659dadd4243994c88e831289f)

src/filebundle.c

index 0ea7f324f4e0eba04088b99dc64a92c3990706c4..295ed00fa1a27f676fbff8df1bc6912338f5fd50 100644 (file)
@@ -78,16 +78,18 @@ static uint8_t *_fb_inflate ( const uint8_t *data, size_t size, size_t orig )
 {
   int err;
   z_stream zstr;
-  uint8_t *bufout;
+  uint8_t *bufin, *bufout;
 
   /* Setup buffers */
+  bufin  = malloc(size);
   bufout = malloc(orig);
+  memcpy(bufin, data, size);
 
   /* Setup zlib */
   memset(&zstr, 0, sizeof(zstr));
   inflateInit2(&zstr, 31);
   zstr.avail_in  = size;
-  zstr.next_in   = data;
+  zstr.next_in   = bufin;
   zstr.avail_out = orig;
   zstr.next_out  = bufout;
     
@@ -97,7 +99,7 @@ static uint8_t *_fb_inflate ( const uint8_t *data, size_t size, size_t orig )
     free(bufout);
     bufout = NULL;
   }
-
+  free(bufin);
   inflateEnd(&zstr);
   
   return bufout;