/* Read an arbitrarily long string. / int read_long_string (const char * const buf) { char * p = NULL; const char * fwd = NULL; size_t len = 0; assert(buf); do { p = realloc(p, len += 256); if (!p) return 0; if (!fwd) fwd = p; else fwd = strchr(p, ' '); } while (fgets(fwd, 256, stdin)); *buf = p; return 1; }
The function read_long_string(), defined above, contains an error that may be particularly visible under heavy stress. Which one of the following describes it?
Reveal answer
Fill a bubble to check yourself