Don't leak memory in error path.
authorJeremy Allison <jra@samba.org>
Wed, 23 Jan 2008 23:23:16 +0000 (15:23 -0800)
committerJeremy Allison <jra@samba.org>
Wed, 23 Jan 2008 23:23:16 +0000 (15:23 -0800)
Jeremy.
(This used to be commit 2df0cdaafdced798f81e30d34371aa1d8e963208)

source3/libsmb/cliconnect.c

index fd860ae7f0a0ea327d5393ef4900b38f7766906a..f3926b777b92e9381e416200fe7fbb80427eb3f1 100644 (file)
@@ -892,6 +892,7 @@ ADS_STATUS cli_session_setup_spnego(struct cli_state *cli, const char *user,
                        if (realm && *realm) {
                                if (asprintf(&principal, "%s$@%s",
                                                machine, realm) < 0) {
                        if (realm && *realm) {
                                if (asprintf(&principal, "%s$@%s",
                                                machine, realm) < 0) {
+                                       SAFE_FREE(machine);
                                        SAFE_FREE(realm);
                                        return ADS_ERROR_NT(NT_STATUS_NO_MEMORY);
                                }
                                        SAFE_FREE(realm);
                                        return ADS_ERROR_NT(NT_STATUS_NO_MEMORY);
                                }