kuser: generate-requests read_words fix sizeof_mistmatch

Use 'sizeof(*w)' to compute the correct size passed to erealloc().
Although sizeof(char **) == sizeof(char *), it is not guaranteed.

Change-Id: I5f66fafe20343d7e736922038d24abcd48bab8bd
This commit is contained in:
Jeffrey Altman
2022-01-24 10:02:26 -05:00
parent ee56cb33b2
commit d8dcb3f7a4

View File

@@ -49,7 +49,7 @@ read_words (const char *filename, char ***ret_w)
buf[strcspn(buf, "\r\n")] = '\0';
if (n >= alloc) {
alloc += 16;
w = erealloc (w, alloc * sizeof(char **));
w = erealloc (w, alloc * sizeof(*w));
}
w[n++] = estrdup (buf);
}