1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 09:27:59 +00:00

osxlaunch: fix some uninitialised pointers.

I've been having intermittent segfaults in this launcher program, and
by means of the new TEST_COMPILE_ON_LINUX facility introduced by
commit eef8cac28, I ran it under valgrind which helpfully pointed out
several pointers between linked-list nodes which I'd been relying on
OS memory allocation to happen to have zeroed for me.
This commit is contained in:
Simon Tatham 2017-12-20 09:38:14 +00:00
parent 6b8cd49aa7
commit 10e570cc79

View File

@ -152,6 +152,8 @@ char *get_unused_env_prefix(void)
exit(1);
}
qhead->prefixlen = 0;
qhead->first_node = NULL;
qhead->next_bucket = NULL;
for (e = environ; *e; e++)
qhead->first_node = new_node(qhead->first_node, *e, strcspn(*e, "="));
@ -168,6 +170,7 @@ char *get_unused_env_prefix(void)
exit(1);
}
buckets[i]->prefixlen = qhead->prefixlen + 1;
buckets[i]->first_node = NULL;
qtail->next_bucket = buckets[i];
qtail = buckets[i];
}