debug: Restore the s3-style check in check_log_size()
[samba.git] / lib / util / dprintf.c
index e4f02758eb8e0c99c610a2dd4695329c42fa314c..e9a15dcbe625c5e41238f208b6b04de10ae00c3f 100644 (file)
@@ -39,6 +39,9 @@ static smb_iconv_t display_cd = (smb_iconv_t)-1;
 
 void d_set_iconv(smb_iconv_t cd)
 {
+       if (display_cd != (smb_iconv_t)-1)
+               talloc_free(display_cd);
+
        display_cd = cd;
 }
 
@@ -60,7 +63,7 @@ _PUBLIC_ int d_vfprintf(FILE *f, const char *format, va_list ap)
 
        if (ret <= 0) return ret;
 
-       clen = convert_string_talloc_descriptor(NULL, display_cd, p, ret, (void **)&p2);
+       clen = iconv_talloc(NULL, display_cd, p, ret, (void **)&p2);
         if (clen == -1) {
                /* the string can't be converted - do the best we can,
                   filling in non-printing chars with '?' */