diff options
Diffstat (limited to 'buildtools/pmdinfogen/pmdinfogen.c')
-rw-r--r-- | buildtools/pmdinfogen/pmdinfogen.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/buildtools/pmdinfogen/pmdinfogen.c b/buildtools/pmdinfogen/pmdinfogen.c index ba1a12e2..96ccbf33 100644 --- a/buildtools/pmdinfogen/pmdinfogen.c +++ b/buildtools/pmdinfogen/pmdinfogen.c @@ -327,6 +327,10 @@ static int locate_pmd_entries(struct elf_info *info) do { new = calloc(sizeof(struct pmd_driver), 1); + if (new == NULL) { + fprintf(stderr, "Failed to calloc memory\n"); + return -1; + } new->name_sym = find_sym_in_symtab(info, "this_pmd_name", last); last = new->name_sym; if (!new->name_sym) @@ -397,7 +401,7 @@ static void output_pmd_info_string(struct elf_info *info, char *outfile) int main(int argc, char **argv) { - struct elf_info info; + struct elf_info info = {0}; int rc = 1; if (argc < 3) { @@ -408,7 +412,8 @@ int main(int argc, char **argv) } parse_elf(&info, argv[1]); - locate_pmd_entries(&info); + if (locate_pmd_entries(&info) < 0) + exit(1); if (info.drivers) { output_pmd_info_string(&info, argv[2]); |