]> git.ipfire.org Git - thirdparty/mlmmj.git/commitdiff
ctrlvalues: fix initialisation of the string list
authorBaptiste Daroussin <bapt@FreeBSD.org>
Fri, 17 Dec 2021 11:19:56 +0000 (12:19 +0100)
committerBaptiste Daroussin <bapt@FreeBSD.org>
Fri, 17 Dec 2021 11:19:56 +0000 (12:19 +0100)
src/controls.c

index b042d5cfac757dde61346b378deadfae56895cd6..daba3c8301f8635c1b81a41aa963938dfbded7c3 100644 (file)
@@ -147,8 +147,7 @@ ctrlvalues(struct mlmmj_list *list, const char *ctrlstr)
                return (NULL);
        }
 
-       ret = xmalloc(sizeof(struct strlist));
-       ret->count = 0;
+       ret = xcalloc(1, sizeof(struct strlist));
 
        while ((buflen = getline(&buf, &bufcap, fp)) > 0) {
                chomp(buf);