1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 09:27:59 +00:00

Fix duplicated exit code in ppk_load_s.

There's no need to have one bunch of free operations before returning
success and another version before returning error. Easier to just set
up the state in the former case so that we can fall through to the
latter.
This commit is contained in:
Simon Tatham 2021-02-20 16:39:12 +00:00
parent ce60ca727c
commit 29b8e26f7d

View File

@ -800,14 +800,13 @@ ssh2_userkey *ppk_load_s(BinarySource *src, const char *passphrase,
goto error;
}
}
sfree(mac);
mac = NULL;
/*
* Create and return the key.
*/
ret = snew(ssh2_userkey);
ret->comment = comment;
comment = NULL;
ret->key = ssh_key_new_priv(
alg, ptrlen_from_strbuf(public_blob),
ptrlen_from_strbuf(private_blob));
@ -817,12 +816,7 @@ ssh2_userkey *ppk_load_s(BinarySource *src, const char *passphrase,
error = "createkey failed";
goto error;
}
strbuf_free(public_blob);
strbuf_free(private_blob);
sfree(encryption);
if (errorstr)
*errorstr = NULL;
return ret;
error = NULL;
/*
* Error processing.