Browse Source

add check for return value of asprintf()

master
T. Meissner 10 years ago
parent
commit
37c2df71dd
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      21st_century_c/process_dir.c

+ 2
- 2
21st_century_c/process_dir.c View File

@ -31,8 +31,8 @@ int process_dir_r(filestruct level) {
filestruct next_level = level; filestruct next_level = level;
next_level.name = entry->d_name; next_level.name = entry->d_name;
(void) asprintf(&next_level.fullname, "%s/%s", level.fullname, entry->d_name);
if (next_level.fullname == NULL) {
if ((asprintf(&next_level.fullname, "%s/%s", level.fullname, entry->d_name) == -1) ||
(next_level.fullname == NULL)) {
return 1; return 1;
} }


Loading…
Cancel
Save