]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Fix two potential bugs in the bug1863 code.
authorKarsten Loesing <karsten.loesing@gmx.net>
Thu, 24 Feb 2011 15:44:54 +0000 (16:44 +0100)
committerKarsten Loesing <karsten.loesing@gmx.net>
Thu, 24 Feb 2011 15:44:54 +0000 (16:44 +0100)
src/or/rephist.c

index 265fff8a37e3b99d462884cecb7499caac9db05c..3f4a70418bbd06700039714e97f154320422c3ce 100644 (file)
@@ -1513,7 +1513,7 @@ rep_hist_update_bwhist_state_section(or_state_t *state,
     smartlist_free(*s_values);
   }
   if (*s_maxima) {
-    SMARTLIST_FOREACH(*s_values, char *, val, tor_free(val));
+    SMARTLIST_FOREACH(*s_maxima, char *, val, tor_free(val));
     smartlist_free(*s_maxima);
   }
   if (! server_mode(get_options())) {
@@ -1541,7 +1541,7 @@ rep_hist_update_bwhist_state_section(or_state_t *state,
   i = (b->num_maxes_set <= b->next_max_idx) ? 0 : b->next_max_idx;
   for (j=0; j < b->num_maxes_set; ++j,++i) {
     uint64_t maxval;
-    if (i > NUM_TOTALS)
+    if (i >= NUM_TOTALS)
       i = 0;
     tor_asprintf(&cp, U64_FORMAT, U64_PRINTF_ARG(b->totals[i] & ~0x3ff));
     smartlist_add(*s_values, cp);