Subject: | Coverity finding: status variable ignored multiple times |
In DB_File.xs the return values of different calls are saved in a variable called status, but this variable is then overwritten several times, discarding the previous value.
In other words, the return status of the calls is ignored. It probably should be either acted on, or if really to be ignored, no point in storing it (cast to void)?
Four spots, line numbers from bleadperl:
...
1439 if (fixed) {
CID 135030: Unused value (UNUSED_VALUE)
1440 status = dbp->set_re_pad(dbp, value) ;
1441 }
1442 else {
CID 135029 (#1 of 1): Unused value (UNUSED_VALUE)
returned_value: Assigning value from (*dbp->set_re_delim)(dbp, value) to status here, but that stored value is overwritten before it can be used.
1443 status = dbp->set_re_delim(dbp, value) ;
...
1448 if (fixed) {
1449 svp = hv_fetch(action, "reclen", 6, FALSE);
1450 if (svp) {
1451 u_int32_t len = my_SvUV32(*svp) ;
CID 135031 (#1 of 1): Unused value (UNUSED_VALUE)
returned_value: Assigning value from (*dbp->set_re_len)(dbp, len) to status here, but that stored value is overwritten before it can be used.
1452 status = dbp->set_re_len(dbp, len) ;
1453 }
...
1456 if (name != NULL) {
CID 135028 (#1 of 1): Unused value (UNUSED_VALUE)
returned_value: Assigning value from (*dbp->set_re_source)(dbp, name) to status here, but that stored value is overwritten before it can be used.
1457 status = dbp->set_re_source(dbp, name) ;
1458 name = NULL ;
1459 }
The final setting/overwrite happens then here:
...
1469
value_overwrite: Overwriting previous write to status with value from (*dbp->set_flags)(dbp, 128U).
1470 status = dbp->set_flags(dbp, (u_int32_t)DB_RENUMBER) ;
But it looks like that status value is also then used for nothing.