X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=lib%2Fbin-info.c;h=e5d515005125510e0537603e05d299aac904839c;hp=813c6830e8717c6f7cd1bd081accead14e27bca4;hb=bfadaf1262452a3f84ab5d6ea8350235b0e99a2c;hpb=15e220d0fe11ab0b103645443574366de97862b7 diff --git a/lib/bin-info.c b/lib/bin-info.c index 813c6830..e5d51500 100644 --- a/lib/bin-info.c +++ b/lib/bin-info.c @@ -482,7 +482,7 @@ end: static int bin_info_set_elf_file(struct bin_info *bin) { - int elf_fd; + int elf_fd = -1; Elf *elf_file = NULL; if (!bin) { @@ -512,7 +512,9 @@ int bin_info_set_elf_file(struct bin_info *bin) return 0; error: - close(elf_fd); + if (elf_fd >= 0) { + close(elf_fd); + } elf_end(elf_file); return -1; }