diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2019-11-14 20:37:52 -0500 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2019-11-14 20:37:52 -0500 |
commit | 668a6f921551dcacd56b94195552f799cc9e4f8f (patch) | |
tree | b100ecee3c4f91464274c87d3eb223bea6efd298 /main.c | |
parent | 0e90fd78a1759af0af31e214aa4c4ba84ffd009d (diff) | |
download | reloc-668a6f921551dcacd56b94195552f799cc9e4f8f.tar.gz |
Plug a few leaks
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -42,13 +42,14 @@ int main(int argc, char *argv[]) { char *replacement = strdup(argv[2]); char *input_file = strdup(argv[3]); char *output_file = strdup(argv[4]); - RelocData *info = reloc_read(input_file); - if (!info) { + size_t records = 0; + size_t replacement_length = strlen(replacement); + RelocData *info = NULL; + + if (!(info = reloc_read(input_file))) { reloc_perror(input_file); exit(reloc_error); } - size_t records = 0; - size_t replacement_length = strlen(replacement); for (size_t i = 0; i < info->size; i++) { RelocMatch *match = NULL; |