From: Adam Sutton Date: Wed, 9 Jan 2013 12:14:46 +0000 (+0000) Subject: timeshift: fix memory leak in reader X-Git-Tag: v3.5~145 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4e67a1345ed8c3baa3ae1d6338f0c3cca3b3eaaf;p=thirdparty%2Ftvheadend.git timeshift: fix memory leak in reader 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. --- diff --git a/src/timeshift/timeshift_reader.c b/src/timeshift/timeshift_reader.c index c3e57d702..a8f300656 100644 --- a/src/timeshift/timeshift_reader.c +++ b/src/timeshift/timeshift_reader.c @@ -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) {