file descriptor leak

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

file descriptor leak

alexc
Hi,


In file shell.c
static char *readFile(const char *zName, int *pnByte){ FILE *in = fopen(zName, "rb”); // == allocate fd in long nIn; size_t nRead; char *pBuf; if( in==0 ) return 0; fseek(in, 0, SEEK_END); nIn = ftell(in); rewind(in); pBuf = sqlite3_malloc64( nIn+1 ); // == try to allocate memory if( pBuf==0 ) return 0; // == check return value, if memory allocation failed, fd in will leak
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users