]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
timeshift: fix memory leak in reader
authorAdam Sutton <dev@adamsutton.me.uk>
Wed, 9 Jan 2013 12:14:46 +0000 (12:14 +0000)
committerAdam Sutton <dev@adamsutton.me.uk>
Wed, 9 Jan 2013 21:26:51 +0000 (21:26 +0000)
I had failed to zero the ref count after reading from disk, this
will garauntee that the refcount never actually reaches zero and
is therefore the pkt is leaked.

src/timeshift/timeshift_reader.c

index c3e57d70213f53270c7fbe1c87b2703cf98e549c..a8f3006565ca983a598ae5a47fa38be200550c0e 100644 (file)
@@ -137,7 +137,8 @@ static ssize_t _read_msg ( int fd, streaming_message_t **sm )
       }
       if (type == SMT_PACKET) {
         th_pkt_t *pkt = data;
-        pkt->pkt_payload = pkt->pkt_header = NULL;
+        pkt->pkt_payload  = pkt->pkt_header = NULL;
+        pkt->pkt_refcount = 0;
         *sm = streaming_msg_create_pkt(pkt);
         r   = _read_pktbuf(fd, &pkt->pkt_header);
         if (r < 0) {