Arg. I hate the "if (xxx) return foo" all on one line style of code.
authorJeremy Allison <jra@samba.org>
Thu, 31 Mar 2011 02:27:29 +0000 (19:27 -0700)
committerJeremy Allison <jra@samba.org>
Thu, 31 Mar 2011 03:19:33 +0000 (05:19 +0200)
Fix the talloc leaks I introduced by not spotting these returns.

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Thu Mar 31 05:19:34 CEST 2011 on sn-devel-104

lib/util/charset/iconv.c

index 24434ec809c910a22259678710b062c8386bfcb7..74b931fa127e5d06e429ff25e1a2a9b12d0ff03b 100644 (file)
@@ -190,13 +190,19 @@ _PUBLIC_ size_t smb_iconv(smb_iconv_t cd,
 
                        if (cd->pull(cd->cd_pull,
                                     inbuf, inbytesleft, &bufp1, &bufsize) == -1
-                           && errno != E2BIG) return -1;
+                           && errno != E2BIG) {
+                               talloc_free(cvtbuf);
+                               return -1;
+                       }
 
                        bufsize = SMB_ICONV_BUFSIZE - bufsize;
 
                        if (cd->push(cd->cd_push,
                                     &bufp2, &bufsize,
-                                    outbuf, outbytesleft) == -1) return -1;
+                                    outbuf, outbytesleft) == -1) {
+                               talloc_free(cvtbuf);
+                               return -1;
+                       }
                }
                talloc_free(cvtbuf);
        }