Increment the DataSetsWritten counter before freeing the RRD values. --kevin
[rrdtool.git] / src / rrd_daemon.c
index 2a35ec2..0e95e90 100644 (file)
@@ -924,9 +924,6 @@ static void *queue_thread_main (void *args __attribute__((unused))) /* {{{ */
       pthread_cond_broadcast(&ci->flushed);
     pthread_mutex_unlock(&cache_lock);
 
       pthread_cond_broadcast(&ci->flushed);
     pthread_mutex_unlock(&cache_lock);
 
-    rrd_free_ptrs((void ***) &values, &values_num);
-    free(file);
-
     if (status == 0)
     {
       pthread_mutex_lock (&stats_lock);
     if (status == 0)
     {
       pthread_mutex_lock (&stats_lock);
@@ -935,6 +932,9 @@ static void *queue_thread_main (void *args __attribute__((unused))) /* {{{ */
       pthread_mutex_unlock (&stats_lock);
     }
 
       pthread_mutex_unlock (&stats_lock);
     }
 
+    rrd_free_ptrs((void ***) &values, &values_num);
+    free(file);
+
     pthread_mutex_lock (&cache_lock);
   }
   pthread_mutex_unlock (&cache_lock);
     pthread_mutex_lock (&cache_lock);
   }
   pthread_mutex_unlock (&cache_lock);