mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-24 04:13:28 +01:00
Fix a few more memory leaks; not in any released Tor
This commit is contained in:
parent
72c4a4eb03
commit
f61088ce23
@ -3779,12 +3779,17 @@ add_onion_helper_keyarg(const char *arg, int discard_pk,
|
||||
memwipe(cp, 0, strlen(cp));
|
||||
tor_free(cp);
|
||||
});
|
||||
smartlist_free(key_args);
|
||||
|
||||
if (!ok) {
|
||||
crypto_pk_free(pk);
|
||||
pk = NULL;
|
||||
}
|
||||
if (err_msg_out) *err_msg_out = err_msg;
|
||||
if (err_msg_out) {
|
||||
*err_msg_out = err_msg;
|
||||
} else {
|
||||
tor_free(err_msg);
|
||||
}
|
||||
*key_new_alg_out = key_new_alg;
|
||||
*key_new_blob_out = key_new_blob;
|
||||
|
||||
|
@ -72,6 +72,7 @@ test_add_onion_helper_keyarg(void *arg)
|
||||
|
||||
/* Test loading a invalid key type. */
|
||||
tor_free(arg_str);
|
||||
crypto_pk_free(pk); pk = NULL;
|
||||
tor_asprintf(&arg_str, "RSA512:%s", encoded);
|
||||
pk = add_onion_helper_keyarg(arg_str, 0, &key_new_alg, &key_new_blob,
|
||||
&err_msg);
|
||||
@ -82,6 +83,7 @@ test_add_onion_helper_keyarg(void *arg)
|
||||
|
||||
/* Test loading a invalid key. */
|
||||
tor_free(arg_str);
|
||||
crypto_pk_free(pk); pk = NULL;
|
||||
tor_free(err_msg);
|
||||
encoded[strlen(encoded)/2] = '\0';
|
||||
tor_asprintf(&arg_str, "RSA1024:%s", encoded);
|
||||
|
Loading…
Reference in New Issue
Block a user