static analyzer bit for symbols.c

src/symbols.c(532): warning: Dereferencing NULL pointer.
                             'tmpsp' contains the same NULL value as 'lastsp' did.
This commit is contained in:
nhmall
2023-12-27 11:10:35 -05:00
parent aedbebad18
commit d51e92d4bd

View File

@@ -529,7 +529,8 @@ parse_sym_line(char *buf, int which_set)
tmpsp = lastsp; /* most recent symset */
for (i = 0; known_handling[i]; ++i)
if (!strcmpi(known_handling[i], bufp)) {
tmpsp->handling = i;
if (tmpsp)
tmpsp->handling = i;
break; /* for loop */
}
break;
@@ -544,13 +545,15 @@ parse_sym_line(char *buf, int which_set)
tmpsp = lastsp; /* most recent symset */
for (i = 0; known_restrictions[i]; ++i) {
if (!strcmpi(known_restrictions[i], bufp)) {
switch (i) {
case 0:
tmpsp->primary = 1;
break;
case 1:
tmpsp->rogue = 1;
break;
if (tmpsp) {
switch (i) {
case 0:
tmpsp->primary = 1;
break;
case 1:
tmpsp->rogue = 1;
break;
}
}
break; /* while loop */
}