Skip to content

Commit

Permalink
Indicate that some variables are not read later in the function
Browse files Browse the repository at this point in the history
Reported by:	clang-scan
  • Loading branch information
gperciva committed Jan 27, 2022
1 parent 2105d7e commit f217415
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tar/multitape/multitape_metadata.c
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,8 @@ multitape_metadata_dec(struct tapemetadata * mdat, uint8_t * buf,
buflen -= 256;
p += 256;

(void)p; /* p is not used beyond this point. */

/* We should be at the end of the metadata now. */
if (buflen != 0)
goto bad2;
Expand Down
4 changes: 4 additions & 0 deletions tar/multitape/multitape_metaindex.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ multitape_metaindex_put(STORAGE_W * S, CHUNKS_W * C,
memcpy(p, mind->tindex, mind->tindexlen);
p += mind->tindexlen;

(void)p; /* p is not used beyond this point. */

/* Compute hash of tape name. */
if (crypto_hash_data(CRYPTO_KEY_HMAC_NAME,
(uint8_t *)mdat->name, strlen(mdat->name), hbuf))
Expand Down Expand Up @@ -273,6 +275,8 @@ multitape_metaindex_get(STORAGE_R * S, CHUNKS_S * C,
if (buflen != 0)
goto corrupt3;

(void)buf; /* buf is not used beyond this point. */

/* Free metaindex buffer. */
free(mbuf);

Expand Down
2 changes: 2 additions & 0 deletions tests/valgrind/potential-memleaks.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ pl_freebsd_getpwuid(void)
exit(1);
}

(void)pwd; /* pwd is not used beyond this point. */

/* POSIX says that we *shall not* free `pwd`. */
}

Expand Down

0 comments on commit f217415

Please sign in to comment.