summaryrefslogtreecommitdiff
path: root/net-analyzer/greenbone-security-assistant/files/greenbone-security-assistant-7.0.3-memleak.patch
blob: 5132e344a798ddf258a98e023649b0a47635f195 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
--- gsa-7.0.3/src/gsad_omp.c	2018-03-28 16:23:57.000000000 +0300
+++ gsa-7.0.3/src/gsad_omp.c	2019-02-02 03:12:16.617046562 +0300
@@ -7737,16 +7738,21 @@
   g_string_append (xml, command_escaped);
   g_free (command_escaped);
 
+  response = NULL;
   ret = omp (connection, credentials, &response, &entity, response_data,
              command->str);
   g_string_free (command, TRUE);
+
+  if (ret)
+    {
+      free_entity (entity);
+      g_string_free (xml, TRUE);
+    }
+
   switch (ret)
     {
       case 0:
         break;
-      case -1:
-        /* 'omp' set response. */
-        return response;
       case 1:
         response_data->http_status_code = MHD_HTTP_INTERNAL_SERVER_ERROR;
         return gsad_message (credentials,
@@ -7770,10 +7776,14 @@
                              "/omp?cmd=get_tasks", response_data);
     }
 
+  if (omp_success (entity) == 0)
+    set_http_status_from_entity (entity, response_data);
   g_string_append (xml, response);
 
   g_string_append (xml, "</get_aggregate>");
 
+  free_entity (entity);
+  g_free (response);
   return xsl_transform_omp (connection, credentials, params,
                             g_string_free (xml, FALSE), response_data);
 }