1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-03-22 06:38:37 -05:00

resolve an issue found by cppcheck:

[unix/osxlaunch.c:133] -> [unix/osxlaunch.c:134]: (warning) Either the condition '!qhead' is redundant or there is possible null pointer dereference: qhead.
This commit is contained in:
Ilya Shipitsin 2017-06-19 20:57:28 +05:00
parent 892d4a0188
commit 4387b5f161

View File

@ -130,11 +130,11 @@ char *get_unused_env_prefix(void)
char **e; char **e;
qhead = (struct bucket *)malloc(sizeof(struct bucket)); qhead = (struct bucket *)malloc(sizeof(struct bucket));
qhead->prefixlen = 0;
if (!qhead) { if (!qhead) {
fprintf(stderr, "out of memory\n"); fprintf(stderr, "out of memory\n");
exit(1); exit(1);
} }
qhead->prefixlen = 0;
for (e = environ; *e; e++) for (e = environ; *e; e++)
qhead->first_node = new_node(qhead->first_node, *e, strcspn(*e, "=")); qhead->first_node = new_node(qhead->first_node, *e, strcspn(*e, "="));