I've been testing the latest version of SQLite with 3 static analysis tools
(Infer, Clang Static Analyzer and Cppcheck) and they all reported a memory
leak error in shell.c .

The Infer error report is as follows:

shell.c:585: error: MEMORY_LEAK

memory dynamically allocated by call to `realloc()` at line 585, column 15
is not reachable after line 585, column 7.

  583.       if( n+100>nLine ){

  584.         nLine = nLine*2 + 100;

  585. >       zLine = realloc(zLine, nLine);

  586.         if( zLine==0 ) return 0;

  587.       }

This error occurs because if the realloc function fails the memory
previously pointed out by zLine becomes inaccessible, you need to ensure
that realloc! = NULL before doing zLine = realloc (zLine, nLine).
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to