@@ -74,6 +74,8 @@ struct dvb_table_filter {
void *priv;
};
+void dvb_table_filter_free(struct dvb_table_filter *sect);
+
int dvb_read_section(struct dvb_v5_fe_parms *parms, int dmx_fd, unsigned char tid, uint16_t pid, void **table,
unsigned timeout);
@@ -158,10 +158,12 @@ static int dvb_parse_section_alloc(struct dvb_v5_fe_parms *parms,
return 0;
}
-static void dvb_parse_section_free(struct dvb_table_filter *sect)
+void dvb_table_filter_free(struct dvb_table_filter *sect)
{
- if (sect->priv)
+ if (sect->priv) {
free(sect->priv);
+ sect->priv = NULL;
+ }
}
static int dvb_parse_section(struct dvb_v5_fe_parms *parms,
@@ -280,7 +282,7 @@ int dvb_read_sections(struct dvb_v5_fe_parms *parms, int dmx_fd,
if (!buf) {
dvb_perror("Out of memory");
dvb_dmx_stop(dmx_fd);
- dvb_parse_section_free(sect);
+ dvb_table_filter_free(sect);
return -1;
}
@@ -327,7 +329,7 @@ int dvb_read_sections(struct dvb_v5_fe_parms *parms, int dmx_fd,
} while (!ret);
free(buf);
dvb_dmx_stop(dmx_fd);
- dvb_parse_section_free(sect);
+ dvb_table_filter_free(sect);
if (ret > 0)
ret = 0;
make dvb_table_filter_free public so it can be used by applications. fix potential double free. Signed-off-by: André Roth <neolynx@gmail.com> --- lib/include/libdvbv5/dvb-scan.h | 2 ++ lib/libdvbv5/dvb-scan.c | 10 ++++++---- 2 files changed, 8 insertions(+), 4 deletions(-)