From 8a785bd34de6e3c5d7b1581bbf2daf6ae82408d6 Mon Sep 17 00:00:00 2001 From: Jacob Nevins Date: Wed, 7 Dec 2005 00:24:45 +0000 Subject: [PATCH] Institutional failure to memset() things pointed at rather than pointers. Things should now be zeroed and memory not leaked. Spotted by Brant Thomsen. [originally from svn r6476] --- import.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/import.c b/import.c index 2e2c12fb..6c936ffc 100644 --- a/import.c +++ b/import.c @@ -444,7 +444,7 @@ static struct openssh_key *load_openssh_key(const Filename *filename, memset(ret->keyblob, 0, ret->keyblob_size); sfree(ret->keyblob); } - memset(&ret, 0, sizeof(ret)); + memset(ret, 0, sizeof(*ret)); sfree(ret); } if (errmsg_p) *errmsg_p = errmsg; @@ -461,7 +461,7 @@ int openssh_encrypted(const Filename *filename) ret = key->encrypted; memset(key->keyblob, 0, key->keyblob_size); sfree(key->keyblob); - memset(&key, 0, sizeof(key)); + memset(key, 0, sizeof(*key)); sfree(key); return ret; } @@ -654,7 +654,7 @@ struct ssh2_userkey *openssh_read(const Filename *filename, char *passphrase, } memset(key->keyblob, 0, key->keyblob_size); sfree(key->keyblob); - memset(&key, 0, sizeof(key)); + memset(key, 0, sizeof(*key)); sfree(key); if (errmsg_p) *errmsg_p = errmsg; return retval; @@ -1099,7 +1099,7 @@ static struct sshcom_key *load_sshcom_key(const Filename *filename, memset(ret->keyblob, 0, ret->keyblob_size); sfree(ret->keyblob); } - memset(&ret, 0, sizeof(ret)); + memset(ret, 0, sizeof(*ret)); sfree(ret); } if (errmsg_p) *errmsg_p = errmsg; @@ -1141,7 +1141,7 @@ int sshcom_encrypted(const Filename *filename, char **comment) *comment = dupstr(key->comment); memset(key->keyblob, 0, key->keyblob_size); sfree(key->keyblob); - memset(&key, 0, sizeof(key)); + memset(key, 0, sizeof(*key)); sfree(key); return answer; } @@ -1416,7 +1416,7 @@ struct ssh2_userkey *sshcom_read(const Filename *filename, char *passphrase, } memset(key->keyblob, 0, key->keyblob_size); sfree(key->keyblob); - memset(&key, 0, sizeof(key)); + memset(key, 0, sizeof(*key)); sfree(key); if (errmsg_p) *errmsg_p = errmsg; return ret;