aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2023-10-21 12:54:22 +0200
committerToni Uhlig <matzeton@googlemail.com>2023-11-06 11:32:36 +0100
commit7c7c7084cd832041aff45d7235e3022a86872714 (patch)
treeb324fd43f1312251021b7aed58b52e818ad177ee
parent59116492e5da7b23a452cf9b1a823ddfc95229af (diff)
Fixed possible memory leak.
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
-rw-r--r--.github/workflows/build.yml2
-rw-r--r--nDPId.c4
2 files changed, 5 insertions, 1 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 2f435b180..83b98ac50 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -147,7 +147,7 @@ jobs:
- name: Build single nDPId executable (invoke CC directly)
if: startsWith(matrix.coverage, '-DENABLE_COVERAGE=OFF') && startsWith(matrix.sanitizer, '-DENABLE_SANITIZER=ON') && startsWith(matrix.ndpid_gcrypt, '-DNDPI_WITH_GCRYPT=OFF') && startsWith(matrix.ndpid_zlib, '-DENABLE_ZLIB=ON')
run: |
- cc -fsanitize=address -fsanitize=undefined -fno-sanitize=alignment -fsanitize=enum -fsanitize=leak nDPId.c utils.c -I./build/libnDPI/include/ndpi -I. -I./dependencies -I./dependencies/jsmn -I./dependencies/uthash/include -o /tmp/a.out -lpcap ./build/libnDPI/lib/libndpi.a -pthread -lm -lz
+ cc -fsanitize=address -fsanitize=undefined -fno-sanitize=alignment -fsanitize=enum -fsanitize=leak nDPId.c nio.c utils.c -I./build/libnDPI/include/ndpi -I. -I./dependencies -I./dependencies/jsmn -I./dependencies/uthash/include -o /tmp/a.out -lpcap ./build/libnDPI/lib/libndpi.a -pthread -lm -lz
- name: Test EXEC
run: |
./build/nDPId-test
diff --git a/nDPId.c b/nDPId.c
index 74c221cef..63311be1a 100644
--- a/nDPId.c
+++ b/nDPId.c
@@ -4415,6 +4415,7 @@ static void run_pcap_loop(struct nDPId_reader_thread * const reader_thread)
{
logger(1, "%s", "Event I/O poll/epoll setup failed");
MT_GET_AND_ADD(reader_thread->workflow->error_or_eof, 1);
+ nio_free(&io);
return;
}
@@ -4425,6 +4426,7 @@ static void run_pcap_loop(struct nDPId_reader_thread * const reader_thread)
"Could not add pcap fd to event queue: %s",
(errno != 0 ? strerror(errno) : "Internal Error"));
MT_GET_AND_ADD(reader_thread->workflow->error_or_eof, 1);
+ nio_free(&io);
return;
}
errno = 0;
@@ -4434,6 +4436,7 @@ static void run_pcap_loop(struct nDPId_reader_thread * const reader_thread)
"Could not add signal fd to event queue: %s",
(errno != 0 ? strerror(errno) : "Internal Error"));
MT_GET_AND_ADD(reader_thread->workflow->error_or_eof, 1);
+ nio_free(&io);
return;
}
@@ -4519,6 +4522,7 @@ static void run_pcap_loop(struct nDPId_reader_thread * const reader_thread)
break;
case PCAP_ERROR_BREAK:
MT_GET_AND_ADD(reader_thread->workflow->error_or_eof, 1);
+ nio_free(&io);
return;
default:
break;