memory leak fix.
authorPekka Riikonen <priikone@silcnet.org>
Sun, 23 Jun 2002 14:41:19 +0000 (14:41 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Sun, 23 Jun 2002 14:41:19 +0000 (14:41 +0000)
lib/silcutil/silcstrutil.c

index 904873062130a79133c2350b31410e2fce571c96..53c1a0241b9805731967f996c0e2f4571a5be9df 100644 (file)
@@ -212,8 +212,9 @@ SilcUInt32 silc_utf8_encode(const unsigned char *bin, SilcUInt32 bin_len,
          iconv_close(icd);
          return utf8_size;
        }
-       iconv_close(icd);
       }
+      if (icd != (iconv_t)-1)
+       iconv_close(icd);
     }
 #endif
 
@@ -355,8 +356,9 @@ SilcUInt32 silc_utf8_decode(const unsigned char *utf8, SilcUInt32 utf8_len,
          iconv_close(icd);
          return bin_size;
        }
-       iconv_close(icd);
       }
+      if (icd != (iconv_t)-1)
+       iconv_close(icd);
     }
 #endif