While I'm here, add an assertion in sshrand.c to catch mistakes in reference
counting.
git-svn-id: svn://svn.tartarus.org/sgt/putty@8846
cda61777-01e9-0310-a592-
d414129be87e
+static char *cmdline_password = NULL;
+
void cmdline_cleanup(void)
{
int pri;
void cmdline_cleanup(void)
{
int pri;
- for (pri = 0; pri < NPRIORITIES; pri++)
+ if (cmdline_password) {
+ memset(cmdline_password, 0, strlen(cmdline_password));
+ sfree(cmdline_password);
+ cmdline_password = NULL;
+ }
+
+ for (pri = 0; pri < NPRIORITIES; pri++) {
sfree(saves[pri].params);
sfree(saves[pri].params);
+ saves[pri].params = NULL;
+ saves[pri].savesize = 0;
+ saves[pri].nsaved = 0;
+ }
}
#define SAVEABLE(pri) do { \
if (need_save) { cmdline_save_param(p, value, pri); return ret; } \
} while (0)
}
#define SAVEABLE(pri) do { \
if (need_save) { cmdline_save_param(p, value, pri); return ret; } \
} while (0)
-static char *cmdline_password = NULL;
-
/*
* Similar interface to get_userpass_input(), except that here a -1
* return means that we aren't capable of processing the prompt and
/*
* Similar interface to get_userpass_input(), except that here a -1
* return means that we aren't capable of processing the prompt and
p->prompts[0]->result_len);
p->prompts[0]->result[p->prompts[0]->result_len-1] = '\0';
memset(cmdline_password, 0, strlen(cmdline_password));
p->prompts[0]->result_len);
p->prompts[0]->result[p->prompts[0]->result_len-1] = '\0';
memset(cmdline_password, 0, strlen(cmdline_password));
+ sfree(cmdline_password);
+ cmdline_password = NULL;
tried_once = 1;
return 1;
tried_once = 1;
return 1;
del234(ssh->portfwds, pf); /* moving next one to index 0 */
free_portfwd(pf);
}
del234(ssh->portfwds, pf); /* moving next one to index 0 */
free_portfwd(pf);
}
+ freetree234(ssh->portfwds);
+ ssh->portfwds = NULL;
#include "putty.h"
#include "ssh.h"
#include "putty.h"
#include "ssh.h"
/* Collect environmental noise every 5 minutes */
#define NOISE_REGULAR_INTERVAL (5*60*TICKSPERSEC)
/* Collect environmental noise every 5 minutes */
#define NOISE_REGULAR_INTERVAL (5*60*TICKSPERSEC)
void random_unref(void)
{
random_active--;
void random_unref(void)
{
random_active--;
+ assert(random_active >= 0);
+ if (random_active) return;
+
+ expire_timer_context(&pool);