Merge "Possible null pointer miss on realloc"

This commit is contained in:
Treehugger Robot 2017-03-23 23:26:39 +00:00 committed by Gerrit Code Review
commit 9bbbaf1480

View file

@ -301,6 +301,7 @@ static void read_canned_config(char* filename)
allocated *= 2;
canned_config = (struct fs_config_entry*)realloc(
canned_config, allocated * sizeof(struct fs_config_entry));
if (canned_config == NULL) die("failed to reallocate memory");
}
struct fs_config_entry* cc = canned_config + used;
@ -320,6 +321,7 @@ static void read_canned_config(char* filename)
++allocated;
canned_config = (struct fs_config_entry*)realloc(
canned_config, allocated * sizeof(struct fs_config_entry));
if (canned_config == NULL) die("failed to reallocate memory");
}
canned_config[used].name = NULL;