You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2017/04/25 22:45:29 UTC

qpid-dispatch git commit: NO-JIRA: Fix incorrect initialization of log.ref_count

Repository: qpid-dispatch
Updated Branches:
  refs/heads/master a41a5c8fc -> c62f5b365


NO-JIRA: Fix incorrect initialization of log.ref_count


Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/c62f5b36
Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/c62f5b36
Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/c62f5b36

Branch: refs/heads/master
Commit: c62f5b3659ed85b3c556333bec8f947db537870c
Parents: a41a5c8
Author: Alan Conway <ac...@redhat.com>
Authored: Tue Apr 25 18:38:44 2017 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Tue Apr 25 18:41:51 2017 -0400

----------------------------------------------------------------------
 src/log.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/c62f5b36/src/log.c
----------------------------------------------------------------------
diff --git a/src/log.c b/src/log.c
index b11fd50..5b96185 100644
--- a/src/log.c
+++ b/src/log.c
@@ -143,7 +143,9 @@ static log_sink_t* log_sink_lh(const char* name) {
         }
 
         sink = NEW(log_sink_t);
-        *sink = (log_sink_t){ 1, strdup(name), };
+        ZERO(sink);
+        sys_atomic_init(&sink->ref_count, 1);
+        sink->name = strdup(name);
         sink->syslog = syslog;
         sink->file = file;
         DEQ_INSERT_TAIL(sink_list, sink);
@@ -520,7 +522,10 @@ qd_error_t qd_log_entity(qd_entity_t *entity) {
             log_sink_t* sink = log_sink_lh(output);
             QD_ERROR_BREAK();
 
-            log_sink_free_lh(src->sink); /* DEFAULT source may already have a sink, so free that sink first */
+            /* DEFAULT source may already have a sink, so free the old sink first */
+            if (src->sink) {
+                log_sink_free_lh(src->sink);
+            }
             src->sink = sink;           /* Assign the new sink   */
 
             if (src->sink->syslog) /* Timestamp off for syslog. */


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org