summaryrefslogtreecommitdiff
path: root/src/analysis
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2018-06-02 11:49:55 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2018-06-02 11:49:55 (GMT)
commit7ebe360e85dceb8db580fd76ec8f4d6865e8a5aa (patch)
tree9057208c869117f1b2d141b725f284ac59c120cb /src/analysis
parent30111e5cf6ff5a7766296ac2579a98c16e7cc7c1 (diff)
Fixed a memory leak when reading packed buffers.
Diffstat (limited to 'src/analysis')
-rw-r--r--src/analysis/db/cdb.c6
-rw-r--r--src/analysis/db/client.c2
-rw-r--r--src/analysis/db/server.c2
3 files changed, 9 insertions, 1 deletions
diff --git a/src/analysis/db/cdb.c b/src/analysis/db/cdb.c
index 7044853..bfe6238 100644
--- a/src/analysis/db/cdb.c
+++ b/src/analysis/db/cdb.c
@@ -876,11 +876,13 @@ static void *g_cdb_archive_process(GCdbArchive *archive)
{
/* Le canal est fermé, une sortie doit être demandée... */
if (fds[i].revents & POLLNVAL)
- goto gcap_bad_exchange;
+ goto gcap_closed_exchange;
/* Données présentes en entrée */
if (fds[i].revents & (POLLIN | POLLPRI))
{
+ init_packed_buffer(&in_pbuf);
+
status = recv_packed_buffer(&in_pbuf, fds[i].fd);
if (!status) goto gcap_bad_exchange;
@@ -958,6 +960,8 @@ static void *g_cdb_archive_process(GCdbArchive *archive)
exit_packed_buffer(&in_pbuf);
+ gcap_closed_exchange:
+
/* TODO : close conn */
;
diff --git a/src/analysis/db/client.c b/src/analysis/db/client.c
index 16d243a..f70c9e1 100644
--- a/src/analysis/db/client.c
+++ b/src/analysis/db/client.c
@@ -406,6 +406,8 @@ static bool g_db_client_start_common(GDbClient *client, const char *desc)
* ou 'DBE_WRONG_VERSION' ... 'DBE_LOADING_ERROR').
*/
+ init_packed_buffer(&in_pbuf);
+
status = recv_packed_buffer(&in_pbuf, client->fd);
if (!status) goto gdsc_error;
diff --git a/src/analysis/db/server.c b/src/analysis/db/server.c
index f6c7a71..eaf3775 100644
--- a/src/analysis/db/server.c
+++ b/src/analysis/db/server.c
@@ -640,6 +640,8 @@ static void *g_db_server_listener(GDbServer *server)
* Tout ceci est à synchroniser avec la fonction g_db_client_start().
*/
+ init_packed_buffer(&in_pbuf);
+
status = recv_packed_buffer(&in_pbuf, fd);
if (!status)
{