From: Mauro Carvalho Chehab Date: Fri, 15 Nov 2013 12:27:13 +0000 (-0200) Subject: libdvbv5/parse_string: don't free twice X-Git-Tag: v4l-utils-1.2.0~360 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=03ab73bcb1aaaf821d3499ac3431f2c7ce6c5c95;p=platform%2Fupstream%2Fv4l-utils.git libdvbv5/parse_string: don't free twice As reported by valgrind, sometimes, it was freeing the same data twice, with was causing random troubles elsewhere. Fix it. Signed-off-by: Mauro Carvalho Chehab --- diff --git a/lib/libdvbv5/parse_string.c b/lib/libdvbv5/parse_string.c index 78c1cea..f7b745e 100644 --- a/lib/libdvbv5/parse_string.c +++ b/lib/libdvbv5/parse_string.c @@ -485,7 +485,10 @@ void parse_string(struct dvb_v5_fe_parms *parms, char **dest, char **emph, *dest = realloc(*dest, strlen(*dest) + 1); if (!len2) { - free (tmp2); + if (tmp2) { + free (tmp2); + tmp2 = NULL; + } free (*emph); *emph = NULL; } else { @@ -493,7 +496,9 @@ void parse_string(struct dvb_v5_fe_parms *parms, char **dest, char **emph, *emph = realloc(*emph, strlen(*emph) + 1); } - free(tmp1); - free(tmp2); + if (tmp1) + free(tmp1); + if (tmp2) + free(tmp2); }