summaryrefslogtreecommitdiff
path: root/source4/lib/charset/iconv.c
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-12-17 08:32:00 +0100
committerStefan Metzmacher <metze@samba.org>2007-12-21 05:50:54 +0100
commit01b96e47cd77c345ac27c4c882e353852e49f22b (patch)
tree8ecaaa7fa3d542fff25ace2a4086e3ba0dbcfc89 /source4/lib/charset/iconv.c
parent83655ec0dd58c21cdb99d5e7c8008b4b3087449b (diff)
downloadsamba-01b96e47cd77c345ac27c4c882e353852e49f22b.tar.gz
samba-01b96e47cd77c345ac27c4c882e353852e49f22b.tar.bz2
samba-01b96e47cd77c345ac27c4c882e353852e49f22b.zip
r26498: Fix memory leak in iconv code.
(This used to be commit 8795697db56e4ca6715950d68f5ec370604fcc76)
Diffstat (limited to 'source4/lib/charset/iconv.c')
-rw-r--r--source4/lib/charset/iconv.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/source4/lib/charset/iconv.c b/source4/lib/charset/iconv.c
index 937b3ec8b5..db212a83c4 100644
--- a/source4/lib/charset/iconv.c
+++ b/source4/lib/charset/iconv.c
@@ -154,17 +154,17 @@ static bool is_utf16(const char *name)
strcasecmp(name, "UTF-16LE") == 0;
}
-/*
- simple iconv_open() wrapper
- */
-smb_iconv_t smb_iconv_open(const char *tocode, const char *fromcode,
- bool native_iconv)
+
+
+smb_iconv_t smb_iconv_open_ex(TALLOC_CTX *mem_ctx, const char *tocode,
+ const char *fromcode, bool native_iconv)
{
smb_iconv_t ret;
const struct charset_functions *from=NULL, *to=NULL;
int i;
- ret = (smb_iconv_t)talloc_named(NULL, sizeof(*ret),
+ ret = (smb_iconv_t)talloc_named(mem_ctx,
+ sizeof(*ret),
"iconv(%s,%s)", tocode, fromcode);
if (!ret) {
errno = ENOMEM;
@@ -261,6 +261,14 @@ failed:
}
/*
+ simple iconv_open() wrapper
+ */
+smb_iconv_t smb_iconv_open(const char *tocode, const char *fromcode)
+{
+ return smb_iconv_open_ex(NULL, tocode, fromcode, true);
+}
+
+/*
simple iconv_close() wrapper
*/
int smb_iconv_close(smb_iconv_t cd)