charconv: Use talloc_tos() in the S3 build
authorVolker Lendecke <vl@samba.org>
Thu, 31 Mar 2011 06:25:32 +0000 (08:25 +0200)
committerVolker Lendecke <vlendec@samba.org>
Thu, 31 Mar 2011 07:14:01 +0000 (09:14 +0200)
In S3 we put a talloc_pool on top of the stack so that an allocation from
talloc_tos() normally is just a pointer increment.

Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Thu Mar 31 09:14:01 CEST 2011 on sn-devel-104

lib/util/charset/iconv.c

index 74b931fa127e5d06e429ff25e1a2a9b12d0ff03b..045fd1329be852f474fa7e5d21f0b85c0c8af400 100644 (file)
@@ -175,8 +175,16 @@ _PUBLIC_ size_t smb_iconv(smb_iconv_t cd,
 #ifndef SMB_ICONV_BUFSIZE
 #define SMB_ICONV_BUFSIZE 2048
 #endif
+               TALLOC_CTX *mem_ctx;
                size_t bufsize;
-               char *cvtbuf = talloc_array(cd, char, SMB_ICONV_BUFSIZE);
+               char *cvtbuf;
+
+#if _SAMBA_BUILD_ == 3
+               mem_ctx = talloc_tos();
+#else
+               mem_ctx = cd;
+#endif
+               cvtbuf = talloc_array(mem_ctx, char, SMB_ICONV_BUFSIZE);
 
                if (!cvtbuf) {
                        return (size_t)-1;