placate 'make syntax-check'
[libguestfs.git] / hivex / hivex.c
index 4fa3b30..b20fe73 100644 (file)
@@ -30,7 +30,6 @@
 #include <iconv.h>
 #include <sys/mman.h>
 #include <sys/stat.h>
 #include <iconv.h>
 #include <sys/mman.h>
 #include <sys/stat.h>
-#include <assert.h>
 #ifdef HAVE_ENDIAN_H
 #include <endian.h>
 #endif
 #ifdef HAVE_ENDIAN_H
 #include <endian.h>
 #endif
@@ -1033,9 +1032,12 @@ windows_utf16_to_utf8 (/* const */ char *input, size_t len)
   size_t r = iconv (ic, &inp, &inlen, &outp, &outlen);
   if (r == (size_t) -1) {
     if (errno == E2BIG) {
   size_t r = iconv (ic, &inp, &inlen, &outp, &outlen);
   if (r == (size_t) -1) {
     if (errno == E2BIG) {
+      size_t prev = outalloc;
       /* Try again with a larger output buffer. */
       free (out);
       outalloc *= 2;
       /* Try again with a larger output buffer. */
       free (out);
       outalloc *= 2;
+      if (outalloc < prev)
+        return NULL;
       goto again;
     }
     else {
       goto again;
     }
     else {