Esme Povirk (@madewokherd) commented about dlls/sane.ds/cfg.c:
CHAR* context = NULL;
size_t new_size = 0;
CHAR* line;
line = strtok_s(content, "\n", &context);
while (line && count < 1000)
{
if (!found && strstr(line, search) == line)
{
lines[count++] = buffer;
found = TRUE;
}
else
{
lines[count++] = strdup(line);
I don't see a reason to make an additional allocation for each line. The original pointer should remain valid until `content` is freed.