Skip to content

Commit

Permalink
Add missing checks for strdup() failure.
Browse files Browse the repository at this point in the history
  • Loading branch information
millert committed Dec 21, 2023
1 parent 5fbf7a3 commit 63f2c54
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions lib/iolog/regress/iolog_path/check_iolog_path.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,24 +252,24 @@ main(int argc, char *argv[])
sudo_fatal(NULL);
break;
case 7:
if (dir_in != NULL)
free(dir_in);
dir_in = strdup(line);
free(dir_in);
if ((dir_in = strdup(line)) == NULL)
sudo_fatal(NULL);
break;
case 8:
if (file_in != NULL)
free(file_in);
file_in = strdup(line);
free(file_in);
if ((file_in = strdup(line)) == NULL)
sudo_fatal(NULL);
break;
case 9:
if (dir_out != NULL)
free(dir_out);
dir_out = strdup(line);
free(dir_out);
if ((dir_out = strdup(line)) == NULL)
sudo_fatal(NULL);
break;
case 10:
if (file_out != NULL)
free(file_out);
file_out = strdup(line);
free(file_out);
if ((file_out = strdup(line)) == NULL)
sudo_fatal(NULL);
break;
case 11:
errors += do_check(dir_in, file_in, dir_out, file_out);
Expand Down

0 comments on commit 63f2c54

Please sign in to comment.