libdvbv5/dvb-scan: avoid memory leak on table read timeout
authorMauro Carvalho Chehab <m.chehab@samsung.com>
Mon, 18 Nov 2013 09:52:53 +0000 (07:52 -0200)
committerMauro Carvalho Chehab <m.chehab@samsung.com>
Wed, 27 Nov 2013 11:24:40 +0000 (09:24 -0200)
Free buf, if table read fails with timeout.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
lib/libdvbv5/dvb-scan.c

index 36c79c1..0eba268 100644 (file)
@@ -125,6 +125,7 @@ int dvb_read_section_with_id(struct dvb_v5_fe_parms *parms, int dmx_fd,
                } while (available < 0 && errno == EOVERFLOW);
 
                if (parms->abort) {
+                       free(buf);
                        if (tbl)
                                free(tbl);
                        return 0;
@@ -132,6 +133,7 @@ int dvb_read_section_with_id(struct dvb_v5_fe_parms *parms, int dmx_fd,
                if (available <= 0) {
                        dvb_logerr("dvb_read_section: no data read on pid %x table %x",
                                   pid, tid);
+                       free(buf);
                        if (tbl)
                                free(tbl);
                        return -1;