aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorcbdev <cb@cbcdn.com>2021-07-03 19:58:47 +0200
committercbdev <cb@cbcdn.com>2021-07-03 19:58:47 +0200
commit22111533d32a30dd52d51a7264c67f8afc7a6bd7 (patch)
tree22cc1ac13c01cf7e06fcdfbc7745d85998af0297
parentbd1481c34bb459e78d6eeef3cc0f179bc3fff8cd (diff)
downloadmidimonster-22111533d32a30dd52d51a7264c67f8afc7a6bd7.tar.gz
midimonster-22111533d32a30dd52d51a7264c67f8afc7a6bd7.tar.bz2
midimonster-22111533d32a30dd52d51a7264c67f8afc7a6bd7.zip
Fix Coverity CID 371696
-rw-r--r--core/core.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/core/core.c b/core/core.c
index 8554f03..415cfc3 100644
--- a/core/core.c
+++ b/core/core.c
@@ -109,6 +109,9 @@ MM_API int mm_manage_fd(int new_fd, char* back, int manage, void* impl){
if(u == fds.n){
fds.fd = realloc(fds.fd, (fds.n + 1) * sizeof(managed_fd));
if(!fds.fd){
+ free(fds.signaled);
+ fds.signaled = NULL;
+ fds.n = 0;
LOG("Failed to allocate memory");
return 1;
}
@@ -116,6 +119,9 @@ MM_API int mm_manage_fd(int new_fd, char* back, int manage, void* impl){
fds.signaled = realloc(fds.signaled, (fds.n + 1) * sizeof(managed_fd));
if(!fds.signaled){
LOG("Failed to allocate memory");
+ free(fds.fd);
+ fds.fd = NULL;
+ fds.n = 0;
return 1;
}
fds.n++;
@@ -179,7 +185,7 @@ int core_iteration(){
#endif
//rebuild fd set if necessary
- if(fd_set_dirty || !fds.signaled){
+ if(fd_set_dirty){
fds.read = core_collect(&(fds.max));
fd_set_dirty = 0;
}