-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 01/05/2015 11:43 PM, Valery Reznic wrote: > I was planing to use this function like following: > > ------------------------------- > > int res; char *errmsg;
I'd recommend you explicitly set that to NULL here. > > res = sqlite3_exec( db, zSql, NULL, NULL, &errmsg ); > > if ( res != SQLITE_OK) { fprintf( stderr, "%s", errmsg) > sqlite3_free( errmsg ) > > } In your print block you can do this: fprintf(stderr, "%d: %s", res, errmsg ? errmsg : "Error"); You can also put this line outside the error block (sqlite3_free on NULL is harmless): sqlite3_free( errmsg ); This way you will always free the message no matter what happened, and will show error text if available. Roger -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlSsO4QACgkQmOOfHg372QROVACeO7Kh4+bz+JME+bdRdeQbvqtt RKoAoJlkUoluQwvITqqTDak+xCQiBtKE =40C3 -----END PGP SIGNATURE----- _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users