With respect to shell.c:shell_exec, there is an inconsistency in how NULL 
checks are applied.  Despite the fact that it seems like `shell_exec` is never 
called with pArg set to NULL, the method is written such that it could be.

In order to be consistent, it seems like pArg should be checked for NULL before 
calling `explain_data_delete`, which dereferences the variable.  It is only 
necessary to call `explain_data_delete` after calling `explain_data_prepare`, 
and the latter is only called when pArg is non-NULL.

I’ve included a diff below to help illustrate what I mean:

---
src/shell.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff a/src/shell.c b/src/shell.c
--- a/src/shell.c
+++ b/src/shell.c
@@ -1954,7 +1954,10 @@ static int shell_exec(
       }

       exec_prepared_stmt(pArg, pStmt, xCallback);
-      explain_data_delete(pArg);
+
+      if( pArg ){
+        explain_data_delete(pArg);
+      }

       /* print usage stats if stats on */
       if( pArg && pArg->statsOn ){
--

Thanks,
Max Radermacher

_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to