Each loop iteration starts with 'i < size'. When i is changed the invariant is kept by checking if 'i == size' and growing the buffer. --- shared/util.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/shared/util.c b/shared/util.c index 479f0fe..1a2b17c 100644 --- a/shared/util.c +++ b/shared/util.c @@ -314,13 +314,7 @@ char *freadline_wrapped(FILE *fp, unsigned int *linenum) n++; { - char *ret; - if (i == size) { - ret = realloc(buf, size + 1); - if (!ret) - return NULL; - } else - ret = buf; + char *ret = buf; ret[i] = '\0'; buf = NULL; if (linenum) -- 2.2.2 -- To unsubscribe from this list: send the line "unsubscribe linux-modules" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html