icsv: memset the newly allocated struct rather than the first - ploot - simple plotting tools Err bitreich.org 70 hgit clone git://bitreich.org/ploot git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/ploot URL:git://bitreich.org/ploot git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/ploot bitreich.org 70 1Log /scm/ploot/log.gph bitreich.org 70 1Files /scm/ploot/files.gph bitreich.org 70 1Refs /scm/ploot/refs.gph bitreich.org 70 1Tags /scm/ploot/tag bitreich.org 70 1README /scm/ploot/file/README.md.gph bitreich.org 70 1LICENSE /scm/ploot/file/LICENSE.gph bitreich.org 70 i--- Err bitreich.org 70 1commit 0ee58964da01ae963b4f8d0a906cba93c3095b8b /scm/ploot/commit/0ee58964da01ae963b4f8d0a906cba93c3095b8b.gph bitreich.org 70 1parent f7f88c2ee5573abff4c44c36bf7b2e705081b2ed /scm/ploot/commit/f7f88c2ee5573abff4c44c36bf7b2e705081b2ed.gph bitreich.org 70 hAuthor: Josuah Demangeon URL:mailto:me@josuah.net bitreich.org 70 iDate: Sun, 27 Jun 2021 01:04:39 +0200 Err bitreich.org 70 i Err bitreich.org 70 icsv: memset the newly allocated struct rather than the first Err bitreich.org 70 i Err bitreich.org 70 iDiffstat: Err bitreich.org 70 i M csv.c | 2 +- Err bitreich.org 70 i Err bitreich.org 70 i1 file changed, 1 insertion(+), 1 deletion(-) Err bitreich.org 70 i--- Err bitreich.org 70 1diff --git a/csv.c b/csv.c /scm/ploot/file/csv.c.gph bitreich.org 70 i@@ -96,8 +96,8 @@ csv_labels(FILE *fp, struct csv **vlp, size_t *ncol) Err bitreich.org 70 i while ((field = strsep(&cp, ","))) { Err bitreich.org 70 i if ((vl = realloc(vl, sz += sizeof *vl)) == NULL) Err bitreich.org 70 i err(1, "realloc: %s", strerror(errno)); Err bitreich.org 70 i- memset(vl, 0, sizeof *vl); Err bitreich.org 70 i col = vl + (*ncol)++; Err bitreich.org 70 i+ memset(col, 0, sizeof *vl); Err bitreich.org 70 i strlcpy(col->label, field, sizeof col->label); Err bitreich.org 70 i } Err bitreich.org 70 i free(line); Err bitreich.org 70 .