From 4e67a1345ed8c3baa3ae1d6338f0c3cca3b3eaaf Mon Sep 17 00:00:00 2001 From: Adam Sutton Date: Wed, 9 Jan 2013 12:14:46 +0000 Subject: [PATCH] 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. --- src/timeshift/timeshift_reader.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/timeshift/timeshift_reader.c b/src/timeshift/timeshift_reader.c index c3e57d70..a8f30065 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) {