diff --git a/src/status.c b/src/status.c index 8f0695d..7a60505 100644 --- a/src/status.c +++ b/src/status.c @@ -114,7 +114,7 @@ status_graph_process(struct status_ctx *ctx, struct status_seq *sq, char *name) gc = xcalloc(1, sizeof(struct status_gcache)); gc->name = xstrdup(name); gc->ndata = 1; - gc->datas = xcalloc(sq->geo.w + sq->geo.w, sizeof(int)); + gc->datas = xcalloc(sq->geo.w << 2, sizeof(int)); gc->datas[0] = sq->data[1]; SLIST_INSERT_HEAD(&ctx->gcache, gc, next); @@ -487,6 +487,8 @@ status_flush_list(struct status_ctx *ctx) free(sq->str); free(sq); } + + SLIST_INIT(&ctx->statushead); } void diff --git a/src/util.h b/src/util.h index c2431e2..3b6c82c 100644 --- a/src/util.h +++ b/src/util.h @@ -23,7 +23,7 @@ /* Insert at the end with SLIST */ #define SLIST_INSERT_TAIL(head, elem, field, prev) \ - if(SLIST_EMPTY(head)) \ + if(!prev) \ SLIST_INSERT_HEAD(head, elem, field); \ else \ SLIST_INSERT_AFTER(prev, elem, field);