about summary refs log tree commit diff
path: root/iconv
diff options
context:
space:
mode:
Diffstat (limited to 'iconv')
-rw-r--r--iconv/gconv_open.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/iconv/gconv_open.c b/iconv/gconv_open.c
index 35ea4782ac..147f5b0e06 100644
--- a/iconv/gconv_open.c
+++ b/iconv/gconv_open.c
@@ -93,25 +93,25 @@ __gconv_open (const char *toset, const char *fromset, __gconv_t *handle,
 	  result->__data[cnt].__internal_use = 0;
 	  result->__data[cnt].__statep = &result->__data[cnt].__state;
 	}
-    }
-
-  if (res != __GCONV_OK)
-    {
-      /* Something went wrong.  Free all the resources.  */
-      int serrno = errno;
 
-      if (result != NULL)
+      if (res != __GCONV_OK)
 	{
-	  while (cnt-- > 0)
-	    free (result->__data[cnt].__outbuf);
+	  /* Something went wrong.  Free all the resources.  */
+	  int serrno = errno;
 
-	  free (result);
-	  result = NULL;
-	}
+	  if (result != NULL)
+	    {
+	      while (cnt-- > 0)
+		free (result->__data[cnt].__outbuf);
+
+	      free (result);
+	      result = NULL;
+	    }
 
-      __gconv_close_transform (steps, nsteps);
+	  __gconv_close_transform (steps, nsteps);
 
-      __set_errno (serrno);
+	  __set_errno (serrno);
+	}
     }
 
   *handle = result;