X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/e055a386af9c83d4a04e72f7c58805f1197df8be..dcbde23605bb045df116a1dd522d4ddb4d9288fa:/pageant.c diff --git a/pageant.c b/pageant.c index 53222fab..888dd430 100644 --- a/pageant.c +++ b/pageant.c @@ -238,7 +238,7 @@ static void add_keyfile(char *filename) { needs_pass = rsakey_encrypted(filename, &comment); attempts = 0; - key = malloc(sizeof(*key)); + key = smalloc(sizeof(*key)); pps.passphrase = passphrase; pps.comment = comment; do { @@ -248,8 +248,8 @@ static void add_keyfile(char *filename) { NULL, PassphraseProc, (LPARAM)&pps); if (!dlgret) { - if (comment) free(comment); - free(key); + if (comment) sfree(comment); + sfree(key); return; /* operation cancelled */ } } else @@ -257,15 +257,15 @@ static void add_keyfile(char *filename) { ret = loadrsakey(filename, key, NULL, passphrase); attempts++; } while (ret == -1); - if (comment) free(comment); + if (comment) sfree(comment); if (ret == 0) { MessageBox(NULL, "Couldn't load private key.", APPNAME, MB_OK | MB_ICONERROR); - free(key); + sfree(key); return; } if (add234(rsakeys, key) != key) - free(key); /* already present, don't waste RAM */ + sfree(key); /* already present, don't waste RAM */ } /* @@ -382,14 +382,14 @@ static void answer_msg(void *msg) { { struct RSAKey *key; char *comment; - key = malloc(sizeof(struct RSAKey)); + key = smalloc(sizeof(struct RSAKey)); memset(key, 0, sizeof(key)); p += makekey(p, key, NULL, 1); p += makeprivate(p, key); p += ssh1_read_bignum(p, NULL); /* p^-1 mod q */ p += ssh1_read_bignum(p, NULL); /* p */ p += ssh1_read_bignum(p, NULL); /* q */ - comment = malloc(GET_32BIT(p)); + comment = smalloc(GET_32BIT(p)); if (comment) { memcpy(comment, p+4, GET_32BIT(p)); key->comment = comment; @@ -401,7 +401,7 @@ static void answer_msg(void *msg) { ret[4] = SSH_AGENT_SUCCESS; } else { freersakey(key); - free(key); + sfree(key); } } break;