movieplayer: memset() with zero length is useless

This commit is contained in:
Stefan Seyfried
2014-04-27 19:31:37 +02:00
parent caf0d96f35
commit af3245b47e

View File

@@ -3,7 +3,7 @@
Movieplayer (c) 2003, 2004 by gagga Movieplayer (c) 2003, 2004 by gagga
Based on code by Dirch, obi and the Metzler Bros. Thanks. Based on code by Dirch, obi and the Metzler Bros. Thanks.
(C) 2011 Stefan Seyfried (C) 2010-2014 Stefan Seyfried
Copyright (C) 2011 CoolStream International Ltd Copyright (C) 2011 CoolStream International Ltd
@@ -1489,12 +1489,11 @@ bool CMoviePlayerGui::convertSubtitle(std::string &text)
size_t ilen = text.length(); size_t ilen = text.length();
size_t olen = ilen*4; size_t olen = ilen*4;
size_t len = olen; size_t len = olen;
char * buf = (char *) malloc(olen+1); char * buf = (char *) calloc(olen + 1, 1);
if (buf == NULL) { if (buf == NULL) {
iconv_close(cd); iconv_close(cd);
return ret; return ret;
} }
memset(buf, olen+1, 0);
char * out = buf; char * out = buf;
char * in = (char *) text.c_str(); char * in = (char *) text.c_str();
if (iconv(cd, &in, &ilen, &out, &olen) == (size_t)-1) { if (iconv(cd, &in, &ilen, &out, &olen) == (size_t)-1) {