mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-03-22 14:39:24 -05:00
Fix a few memory leaks.
Mostly noticed in passing while using Address / Leak Sanitiser to check over the previous commit. One highlight here is freeing of the previous iqmp value in rsa_verify, which was actually a potentially sensitive leak, introduced in the mp_int rewrite (commit 25b034ee3).
This commit is contained in:
parent
d07d7d66f6
commit
3e881a4248
3
cmdgen.c
3
cmdgen.c
@ -1072,6 +1072,9 @@ int main(int argc, char **argv)
|
|||||||
ssh_key_free(ssh2key->key);
|
ssh_key_free(ssh2key->key);
|
||||||
sfree(ssh2key);
|
sfree(ssh2key);
|
||||||
}
|
}
|
||||||
|
sfree(origcomment);
|
||||||
|
if (infilename)
|
||||||
|
filename_free(infilename);
|
||||||
filename_free(outfilename);
|
filename_free(outfilename);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -519,6 +519,7 @@ static void read_clip_setting(settings_r *sesskey, char *savekey,
|
|||||||
val = CLIPUI_NONE;
|
val = CLIPUI_NONE;
|
||||||
}
|
}
|
||||||
conf_set_int(conf, confkey, val);
|
conf_set_int(conf, confkey, val);
|
||||||
|
sfree(setting);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *save_settings(const char *section, Conf *conf)
|
char *save_settings(const char *section, Conf *conf)
|
||||||
|
@ -66,6 +66,7 @@ void ssh_transient_hostkey_cache_free(ssh_transient_hostkey_cache *thc)
|
|||||||
sfree(ent);
|
sfree(ent);
|
||||||
}
|
}
|
||||||
freetree234(thc->cache);
|
freetree234(thc->cache);
|
||||||
|
sfree(thc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ssh_transient_hostkey_cache_add(
|
void ssh_transient_hostkey_cache_add(
|
||||||
|
@ -451,6 +451,7 @@ void invent_firstbits(unsigned *one, unsigned *two, unsigned min_separation)
|
|||||||
}
|
}
|
||||||
|
|
||||||
mp_free(randval);
|
mp_free(randval);
|
||||||
|
mp_free(total);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check everything came out right.
|
* Check everything came out right.
|
||||||
|
1
sshrsa.c
1
sshrsa.c
@ -332,6 +332,7 @@ bool rsa_verify(RSAKey *key)
|
|||||||
mp_int *q_new = mp_min(key->p, key->q);
|
mp_int *q_new = mp_min(key->p, key->q);
|
||||||
mp_free(key->p);
|
mp_free(key->p);
|
||||||
mp_free(key->q);
|
mp_free(key->q);
|
||||||
|
mp_free(key->iqmp);
|
||||||
key->p = p_new;
|
key->p = p_new;
|
||||||
key->q = q_new;
|
key->q = q_new;
|
||||||
key->iqmp = mp_invert(key->q, key->p);
|
key->iqmp = mp_invert(key->q, key->p);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user