summary refs log tree commit diff
path: root/iconv/gconv_close.c
diff options
context:
space:
mode:
Diffstat (limited to 'iconv/gconv_close.c')
-rw-r--r--iconv/gconv_close.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/iconv/gconv_close.c b/iconv/gconv_close.c
index 791c0259a3..912fa26d13 100644
--- a/iconv/gconv_close.c
+++ b/iconv/gconv_close.c
@@ -40,11 +40,11 @@ __gconv_close (gconv_t cd)
       if (srunp->end_fct != NULL)
 	(*srunp->end_fct) (drunp);
       else
-	{
-	  free (drunp->outbuf);
-	  if (drunp->data != NULL)
-	    free (drunp->data);
-	}
+	if (drunp->data != NULL)
+	  free (drunp->data);
+
+      if (!drunp->is_last && drunp->outbuf != NULL)
+	free (drunp->outbuf);
 
       /* Next step.  */
       ++srunp;