/ Check-in [fe053b2e]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix a malloc/sqlite3_free mismatch in the shell tool code.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: fe053b2ecdc04b918367fa503bf10292fd7cd84a6929670857b2e9153df4d1f9
User & Date: dan 2018-01-08 17:05:32
Context
2018-01-08
17:09
Remove a superfluous define from the 'fileio' extension when compiled for Win32. check-in: 6dcba669 user: mistachkin tags: trunk
17:05
Fix a malloc/sqlite3_free mismatch in the shell tool code. check-in: fe053b2e user: dan tags: trunk
14:24
Fix compilation of 'sqltclsh.exe' for MSVC. check-in: abb112d9 user: mistachkin tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/shell.c.in.

798
799
800
801
802
803
804
805
806

807
808
809
810
811
812
813
...
859
860
861
862
863
864
865
866
867
868
869

870
871
872
873
874
875
876
  sqlite3_context *pCtx,
  int nVal,
  sqlite3_value **apVal
){
  const char *zName = (const char*)sqlite3_value_text(apVal[0]);
  char *zFake = shellFakeSchema(sqlite3_context_db_handle(pCtx), 0, zName);
  if( zFake ){
    sqlite3_result_text(pCtx, sqlite3_mprintf("/* %z */", zFake),
                        -1, sqlite3_free);

  }
}

/*
** SQL function:  shell_add_schema(S,X)
**
** Add the schema name X to the CREATE statement in S and return the result.
................................................................................
          }
        }
        if( zName
         && aPrefix[i][0]=='V'
         && (zFake = shellFakeSchema(db, zSchema, zName))!=0
        ){
          if( z==0 ){
            z = sqlite3_mprintf("%s\n/* %z */", zIn, zFake);
          }else{
            z = sqlite3_mprintf("%z\n/* %z */", z, zFake);
          }

        }
        if( z ){
          sqlite3_result_text(pCtx, z, -1, sqlite3_free);
          return;
        }
      }
    }







|

>







 







|

|

>







798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
...
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
  sqlite3_context *pCtx,
  int nVal,
  sqlite3_value **apVal
){
  const char *zName = (const char*)sqlite3_value_text(apVal[0]);
  char *zFake = shellFakeSchema(sqlite3_context_db_handle(pCtx), 0, zName);
  if( zFake ){
    sqlite3_result_text(pCtx, sqlite3_mprintf("/* %s */", zFake),
                        -1, sqlite3_free);
    free(zFake);
  }
}

/*
** SQL function:  shell_add_schema(S,X)
**
** Add the schema name X to the CREATE statement in S and return the result.
................................................................................
          }
        }
        if( zName
         && aPrefix[i][0]=='V'
         && (zFake = shellFakeSchema(db, zSchema, zName))!=0
        ){
          if( z==0 ){
            z = sqlite3_mprintf("%s\n/* %s */", zIn, zFake);
          }else{
            z = sqlite3_mprintf("%z\n/* %s */", z, zFake);
          }
          free(zFake);
        }
        if( z ){
          sqlite3_result_text(pCtx, z, -1, sqlite3_free);
          return;
        }
      }
    }