mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-29 08:01:23 +03:00
In dbfuzz2, avoid using a malloc in the LLVMFuzzerInitialize() initializer
routine, so that no memory leaks are reported. Also, show the version of SQLite being used when the -v option is on. FossilOrigin-Name: 824f93246988ffa213bbd41a7de08886999b1a8ae00fdf6b9767acb6e3ec6a1f
This commit is contained in:
@ -134,11 +134,7 @@ static int numberOfVChar(const char *z){
|
||||
int LLVMFuzzerInitialize(int *pArgc, char ***pArgv){
|
||||
int i, j, n;
|
||||
int argc = *pArgc;
|
||||
char **newArgv;
|
||||
char **argv = *pArgv;
|
||||
newArgv = malloc( sizeof(char*)*(argc+1) );
|
||||
if( newArgv==0 ) return 0;
|
||||
newArgv[0] = argv[0];
|
||||
for(i=j=1; i<argc; i++){
|
||||
char *z = argv[i];
|
||||
if( z[0]=='-' ){
|
||||
@ -153,10 +149,9 @@ int LLVMFuzzerInitialize(int *pArgc, char ***pArgv){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
newArgv[j++] = argv[i];
|
||||
argv[j++] = argv[i];
|
||||
}
|
||||
newArgv[j] = 0;
|
||||
*pArgv = newArgv;
|
||||
argv[j] = 0;
|
||||
*pArgc = j;
|
||||
return 0;
|
||||
}
|
||||
@ -202,6 +197,9 @@ int main(int argc, char **argv){
|
||||
free(pIn);
|
||||
}
|
||||
}
|
||||
if( eVerbosity>0 ){
|
||||
printf("SQLite %s\n", sqlite3_sourceid());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif /*STANDALONE*/
|
||||
|
Reference in New Issue
Block a user