From 677a0f8142ac65b61f1a11bbd7273da62409f9a2 Mon Sep 17 00:00:00 2001 From: Stefan Sperling Date: Thu, 23 Aug 2018 14:52:56 +0200 Subject: osmocon: fix use of an initialized variable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit osmocon.c: In function ‘read_file’: osmocon.c:317:3: warning: ‘fd’ may be used uninitialized in this function Change-Id: If07c58d5b55c18c05345607064eace02748935f8 --- src/host/osmocon/osmocon.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/host/osmocon') diff --git a/src/host/osmocon/osmocon.c b/src/host/osmocon/osmocon.c index 131eab74..a9497dc4 100644 --- a/src/host/osmocon/osmocon.c +++ b/src/host/osmocon/osmocon.c @@ -314,7 +314,8 @@ int read_file(const char *filename, int chainload) dnload.data = malloc(MAX_HDR_SIZE + payload_size); if (!dnload.data) { - close(fd); + if (!chainload) + close(fd); fprintf(stderr, "No memory\n"); return -ENOMEM; } -- cgit v1.2.3