aboutsummaryrefslogtreecommitdiffstats
path: root/vppinfra/vppinfra/elf.c
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2016-08-08 13:05:31 -0400
committerDave Barach <dave@barachs.net>2016-08-08 13:09:15 -0400
commit6f6f34f620a18638eb820a9ab3d8a93e350d722a (patch)
treef0e03e0a2e96b10511561e5868a4ff741a9386f4 /vppinfra/vppinfra/elf.c
parent06e3d075760be43dbd61385d3c7861cd5fe44af2 (diff)
VPP-189 Clean up more coverity warnings
Change-Id: If66713d79c545c762c385faf08cc809347741152 Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'vppinfra/vppinfra/elf.c')
-rw-r--r--vppinfra/vppinfra/elf.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/vppinfra/vppinfra/elf.c b/vppinfra/vppinfra/elf.c
index 71ae1d33d70..8c5dc6c33e0 100644
--- a/vppinfra/vppinfra/elf.c
+++ b/vppinfra/vppinfra/elf.c
@@ -582,7 +582,7 @@ format_elf_main (u8 * s, va_list * args)
s = format (s, "\nSegments: %d at file offset 0x%Lx-0x%Lx:\n",
fh->segment_header_count,
fh->segment_header_file_offset,
- fh->segment_header_file_offset + fh->segment_header_count * fh->segment_header_size);
+ (u64) fh->segment_header_file_offset + fh->segment_header_count * fh->segment_header_size);
s = format (s, "%U\n", format_elf_segment, 0);
vec_foreach (h, copy)
@@ -1827,8 +1827,12 @@ clib_error_t * elf_write_file (elf_main_t * em, char * file_name)
/* Finally write section headers. */
if (fseek (f, em->file_header.section_header_file_offset, SEEK_SET) < 0)
- return clib_error_return_unix (0, "fseek 0x%Lx", em->file_header.section_header_file_offset);
-
+ {
+ fclose(f);
+ return clib_error_return_unix
+ (0, "fseek 0x%Lx", em->file_header.section_header_file_offset);
+ }
+
vec_foreach (s, em->sections)
{
elf64_section_header_t h;