summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Sperling <ssperling@sysmocom.de>2018-08-23 14:52:56 +0200
committerStefan Sperling <ssperling@sysmocom.de>2018-08-23 14:52:56 +0200
commit677a0f8142ac65b61f1a11bbd7273da62409f9a2 (patch)
tree5f7938ea5526a0277c1adf3e5905871af0039924
parent316f22f057d7d2063a2d33ac157e848eba590ecb (diff)
osmocon: fix use of an initialized variable
osmocon.c: In function ‘read_file’: osmocon.c:317:3: warning: ‘fd’ may be used uninitialized in this function Change-Id: If07c58d5b55c18c05345607064eace02748935f8
-rw-r--r--src/host/osmocon/osmocon.c3
1 files changed, 2 insertions, 1 deletions
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;
}