From ec14d57b5224166c9665f85f406745ec2f4f5a0f Mon Sep 17 00:00:00 2001
From: Cyrille Bagard <nocbos@gmail.com>
Date: Wed, 25 Apr 2018 00:29:52 +0200
Subject: Avoided a double free in case of archive creation failure.

---
 src/analysis/db/server.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/analysis/db/server.c b/src/analysis/db/server.c
index 1565501..0debd83 100644
--- a/src/analysis/db/server.c
+++ b/src/analysis/db/server.c
@@ -739,8 +739,6 @@ static void *g_db_server_listener(GDbServer *server)
             status = send_packed_buffer(&out_pbuf, fd);
             if (!status) goto gdsl_out_error;
 
-            exit_packed_buffer(&out_pbuf);
-
             /**
              * L'ajout dans la liste des clients connectés provoque un envoie de mises à jour.
              * L'éventuelle erreur survenant pendant l'envoi ne peut donc pas être remontée
@@ -754,6 +752,8 @@ static void *g_db_server_listener(GDbServer *server)
                 server->archives = g_list_append(server->archives, archive);
                 error = g_cdb_archive_add_client(archive, fd, &user);
 
+                exit_packed_buffer(&out_pbuf);
+
                 free(peer_name);
 
                 exit_rle_string(&hash);
-- 
cgit v0.11.2-87-g4458