Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame^] | 1 | logwriter: Don't allocate a new buffer if fails to consume current item |
| 2 | |
| 3 | Upstream-Status: Pending |
| 4 | |
| 5 | Signed-off-by: Xufeng Zhang <xufeng.zhang@windriver.com> |
| 6 | --- |
| 7 | --- a/lib/logwriter.c |
| 8 | +++ b/lib/logwriter.c |
| 9 | @@ -1010,7 +1010,7 @@ |
| 10 | { |
| 11 | status = log_proto_client_post(proto, (guchar *) self->line_buffer->str, self->line_buffer->len, &consumed); |
| 12 | |
| 13 | - if (consumed) |
| 14 | + if (consumed && status != LPS_ERROR) |
| 15 | log_writer_realloc_line_buffer(self); |
| 16 | |
| 17 | if (status == LPS_ERROR) |
| 18 | @@ -1028,7 +1028,7 @@ |
| 19 | NULL); |
| 20 | consumed = TRUE; |
| 21 | } |
| 22 | - if (consumed) |
| 23 | + if (consumed && status != LPS_ERROR) |
| 24 | { |
| 25 | if (lm->flags & LF_LOCAL) |
| 26 | step_sequence_number(&self->seq_num); |