mirror of
https://github.com/obgm/libcoap.git
synced 2026-11-15 04:39:42 +03:00
coap-server.c: add missing fclose in read_file_mem
This fixes CID 1495722.
This commit is contained in:
1 parent
e413fd545b
commit
ba45a57efc
1 file changed
+3
-1
@@ -749,8 +749,10 @@ static uint8_t *read_file_mem(const char* file, size_t *length) {
|
||||
}
|
||||
|
||||
buf = malloc(statbuf.st_size+1);
|
||||
if (!buf)
|
||||
if (!buf) {
|
||||
fclose(f);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (fread(buf, 1, statbuf.st_size, f) != (size_t)statbuf.st_size) {
|
||||
fclose(f);
|
||||
|
||||
Reference in new issue
Block a user