From 5ca0fc850af713a49e0d07fdbbe7e0ebd4127ca6 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sun, 15 Jan 2012 21:10:17 -0200 Subject: [PATCH] utils/dvb/parse_string: Fix a wrong cut-and-paste While here, cleanup the malloc's for the temp tables. Signed-off-by: Mauro Carvalho Chehab --- utils/dvb/parse_string.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/utils/dvb/parse_string.c b/utils/dvb/parse_string.c index c9b37ba..f073a07 100644 --- a/utils/dvb/parse_string.c +++ b/utils/dvb/parse_string.c @@ -342,12 +342,12 @@ void parse_string(char **dest, char **emph, int emphasis = 0; if (*dest) { - free (*dest); + free(*dest); *dest = NULL; } if (*emph) { - free (*dest); - *dest = NULL; + free(*emph); + *emph = NULL; } if (!len) return; @@ -409,10 +409,9 @@ void parse_string(char **dest, char **emph, /* * Handles the ISO/IEC 10646 1-byte control codes * (EN 300 468 v1.11.1 Table A.1) - * Emphasis will be represented as: *emphased* */ - tmp1 = malloc(len + 2); - tmp2 = malloc(len + 2); + tmp1 = malloc(len); + tmp2 = malloc(len); p = (char *)tmp1; p2 = (char *)tmp2; s = src; @@ -459,5 +458,4 @@ void parse_string(char **dest, char **emph, if (tmp1) free(tmp1); - } -- 2.7.4