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:
@@ -49,7 +49,7 @@ read_words (const char *filename, char ***ret_w)
|
|||||||
buf[strcspn(buf, "\r\n")] = '\0';
|
buf[strcspn(buf, "\r\n")] = '\0';
|
||||||
if (n >= alloc) {
|
if (n >= alloc) {
|
||||||
alloc += 16;
|
alloc += 16;
|
||||||
w = erealloc (w, alloc * sizeof(char **));
|
w = erealloc (w, alloc * sizeof(*w));
|
||||||
}
|
}
|
||||||
w[n++] = estrdup (buf);
|
w[n++] = estrdup (buf);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user