X-Git-Url: https://www.tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Ftop.c;h=4db930439ab80c205998c2f3739ab45538b303d2;hb=6168a9b6d51b19378af9ba9977227042cf6eafc6;hp=703391c5468476e36f13c659e82fe380eaec0ceb;hpb=aa465969918ce3f3332f5829dbc482fc3b732012;p=tinc diff --git a/src/top.c b/src/top.c index 703391c5..4db93043 100644 --- a/src/top.c +++ b/src/top.c @@ -108,7 +108,7 @@ static void update(int fd) { found = ns; break; } else { - found = xmalloc_and_zero(sizeof *found); + found = xzalloc(sizeof *found); found->name = xstrdup(name); list_insert_before(&node_list, node, found); changed = true; @@ -117,7 +117,7 @@ static void update(int fd) { } if(!found) { - found = xmalloc_and_zero(sizeof *found); + found = xzalloc(sizeof *found); found->name = xstrdup(name); list_insert_tail(&node_list, found); changed = true; @@ -213,7 +213,8 @@ static void redraw(void) { for(int i = 0; i < n; i++) sorted[i]->i = i; - qsort(sorted, n, sizeof *sorted, sortfunc); + if(sorted) + qsort(sorted, n, sizeof *sorted, sortfunc); for(int i = 0, row = 3; i < n; i++, row++) { nodestats_t *node = sorted[i];