Click on image to see enlargment
Alex is automating his fantasy football lineup changes and learning C at the same time. In reading his data into memory, he is making a critical mistake. Can you find it?
bug534.c lint Output
--- Module: bug534.c (C) _ if( !f ) return NULL; bug534.c(13) : Warning 429: Custodial pointer 'buf' (line 7) has not been freed or returned _ realloc( buf, length + 100 ); bug534.c(18) : Warning 534: Ignoring return value of function 'realloc(void *, unsigned int)' (compare with line 108, file c:\compiler\include\malloc.h) bug534.c(15) : Warning 449: Pointer variable 'buf' previously deallocated [Reference: file bug534.c: line 18]
Reference Manual Explanation
534 Ignoring return value of function 'Symbol' (compare with Location) -- A function that returns a value is called just for side effects as, for example, in a statement by itself or the left-hand side of a comma operator. Try: (void) function(); to call a function and ignore its return value. See also the fvr, fvo and fdr flags.
Previous Bug - Bug #1529 - September 2012