indent(1): Fix off-by-one in control flow leading dead code.
Coverity correctly reported that it's impossible for /comparison/ to be 0 here, because the only way for the for loop to end is by /comparison/ being < 0. Fortunately the consequences of this bug weren't severe; for duplicated entries in the typedef names file it would unnecessarily duplicate strings with strdup(), but pointers to those would replace existing ones. So this was a memory leak at worst. CID: 1361477 Obtained from: Piotr Stephaniak
This commit is contained in:
parent
6ff6aea629
commit
8e7c1235ce
@ -613,7 +613,7 @@ add_typename(const char *key)
|
|||||||
else {
|
else {
|
||||||
int p;
|
int p;
|
||||||
|
|
||||||
for (p = 0; (comparison = strcmp(key, typenames[p])) >= 0; p++)
|
for (p = 0; (comparison = strcmp(key, typenames[p])) > 0; p++)
|
||||||
/* find place for the new key */;
|
/* find place for the new key */;
|
||||||
if (comparison == 0) /* remove duplicates */
|
if (comparison == 0) /* remove duplicates */
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user