Address splint warnings about setting and clearing state->control.name (#165).

This commit is contained in:
Andrew Wood
2025-07-27 21:34:46 +01:00
parent 574ea04502
commit a7f392e3c3
2 changed files with 8 additions and 1 deletions
+1 -1
View File
@@ -494,7 +494,7 @@ struct pvwatchfd_s {
char file_fd[PV_SIZEOF_FILE_FD]; /* path to /proc fd symlink */
#endif
char file_fdpath[PV_SIZEOF_FILE_FDPATH]; /* path to file that was opened */
char display_name[PV_SIZEOF_DISPLAY_NAME]; /* name to show on progress bar */
/*@keep@ */ char display_name[PV_SIZEOF_DISPLAY_NAME]; /* name to show on progress bar */
struct stat sb_fd; /* stat of fd symlink */
struct stat sb_fd_link; /* lstat of fd symlink */
off_t size; /* size of whole file, 0 if unknown */
+7
View File
@@ -1003,7 +1003,14 @@ int pv_watchpid_loop(pvstate_t state)
&(state->control), &(info_array[idx].state->flags),
&(info_array[idx].state->transfer), &(info_array[idx].state->calc),
&(state->cursor), &(info_array[idx].state->display), NULL, false);
/*@-mustfreeonly@ */
state->control.name = NULL;
/*
* splint warns of a memory leak, but we'd
* set name to be an alias of display_name,
* so nothing is lost here.
*/
/*@+mustfreeonly@ */
displayed_lines++;
}
}