summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiguel Freitas <miguelfreitas@users.sourceforge.net>2004-12-19 19:28:58 +0000
committerMiguel Freitas <miguelfreitas@users.sourceforge.net>2004-12-19 19:28:58 +0000
commit709552aeea14284f980ace3e71c786c26f0371d5 (patch)
tree6edac5fe07064b70d086ff9be32bbc0c4ad95af4
parentc6e7c0fc0a0dd3c94f478f01cc93cee76b0fa07f (diff)
downloadxine-lib-709552aeea14284f980ace3e71c786c26f0371d5.tar.gz
xine-lib-709552aeea14284f980ace3e71c786c26f0371d5.tar.bz2
fix leak
CVS patchset: 7281 CVS date: 2004/12/19 19:28:58
-rw-r--r--src/xine-engine/info_helper.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/xine-engine/info_helper.c b/src/xine-engine/info_helper.c
index 273744149..05a24566c 100644
--- a/src/xine-engine/info_helper.c
+++ b/src/xine-engine/info_helper.c
@@ -20,7 +20,7 @@
* stream metainfo helper functions
* hide some xine engine details from demuxers and reduce code duplication
*
- * $Id: info_helper.c,v 1.12 2004/12/12 00:47:15 miguelfreitas Exp $
+ * $Id: info_helper.c,v 1.13 2004/12/19 19:28:58 miguelfreitas Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -195,20 +195,26 @@ static void __meta_info_set_unlocked_utf8(xine_stream_t *stream, int info, const
static void __meta_info_set_unlocked_encoding(xine_stream_t *stream, int info, const char *value, const char *enc) {
#ifdef HAVE_ICONV
iconv_t cd;
+ char *system_enc = NULL;
if (value) {
if (enc == NULL) {
- if ((enc = xine_get_system_encoding()) == NULL) {
+ if ((enc = system_enc = xine_get_system_encoding()) == NULL) {
xprintf(stream->xine, XINE_VERBOSITY_LOG,
_("info_helper: can't find out current locale character set\n"));
}
}
if (enc) {
- if ((cd = iconv_open("UTF-8", enc)) == (iconv_t)-1) {
+ cd = iconv_open("UTF-8", enc);
+ if (cd == (iconv_t)-1)
xprintf(stream->xine, XINE_VERBOSITY_LOG,
_("info_helper: unsupported conversion %s -> UTF-8, no conversion performed\n"), enc);
- } else {
+
+ if (system_enc)
+ free(system_enc);
+
+ if (cd != (iconv_t)-1) {
char *utf8_value;
char *inbuf, *outbuf;
size_t inbytesleft, outbytesleft;