aboutsummaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-support/syslog-ng/files/logwriter-still-free-the-unconsumed-item.patch
blob: 31110933f09a7cf98411d77463988b30416ec816 (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
43
44
45
46
47
logwritter: still free the unconsumed item during reloading configuration

Otherwise we have no chance to free this stuff.

Upstream-Status: Pending

Signed-off-by: Xufeng Zhang <xufeng.zhang@windriver.com>
---
--- a/lib/logwriter.c
+++ b/lib/logwriter.c
@@ -39,6 +39,7 @@
 #include <iv.h>
 #include <iv_event.h>
 #include <iv_work.h>
+#include "logproto/logproto-text-client.h"
 
 typedef enum
 {
@@ -978,6 +979,7 @@
   gint count = 0;
   gboolean ignore_throttle = (flush_mode >= LW_FLUSH_QUEUE);
   LogProtoStatus status = LPS_SUCCESS;
+  LogProtoTextClient *self_text;
   
   if (!proto)
     return FALSE;
@@ -1035,7 +1037,18 @@
         }
       else
         {
-          /* push back to the queue */
-          log_queue_push_head(self->queue, lm, &path_options);
+          self_text = (LogProtoTextClient *) proto;
+          /* free the unconsumed message during reloading configuration */ 
+          if ((LW_FLUSH_QUEUE == flush_mode) && self_text->partial_free && self_text->partial)
+            {
+              self_text->partial_free(self_text->partial);
+              self_text->partial = NULL;
+              log_msg_unref(lm);
+            }
+          else
+            {
+              /* push back to the queue */
+              log_queue_push_head(self->queue, lm, &path_options);
+            }
           msg_set_context(NULL);
           log_msg_refcache_stop();