/ Check-in [fe053b2e]
Login

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 Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/shell.c.in.

   798    798     sqlite3_context *pCtx,
   799    799     int nVal,
   800    800     sqlite3_value **apVal
   801    801   ){
   802    802     const char *zName = (const char*)sqlite3_value_text(apVal[0]);
   803    803     char *zFake = shellFakeSchema(sqlite3_context_db_handle(pCtx), 0, zName);
   804    804     if( zFake ){
   805         -    sqlite3_result_text(pCtx, sqlite3_mprintf("/* %z */", zFake),
          805  +    sqlite3_result_text(pCtx, sqlite3_mprintf("/* %s */", zFake),
   806    806                           -1, sqlite3_free);
          807  +    free(zFake);
   807    808     }
   808    809   }
   809    810   
   810    811   /*
   811    812   ** SQL function:  shell_add_schema(S,X)
   812    813   **
   813    814   ** Add the schema name X to the CREATE statement in S and return the result.
................................................................................
   859    860             }
   860    861           }
   861    862           if( zName
   862    863            && aPrefix[i][0]=='V'
   863    864            && (zFake = shellFakeSchema(db, zSchema, zName))!=0
   864    865           ){
   865    866             if( z==0 ){
   866         -            z = sqlite3_mprintf("%s\n/* %z */", zIn, zFake);
          867  +            z = sqlite3_mprintf("%s\n/* %s */", zIn, zFake);
   867    868             }else{
   868         -            z = sqlite3_mprintf("%z\n/* %z */", z, zFake);
          869  +            z = sqlite3_mprintf("%z\n/* %s */", z, zFake);
   869    870             }
          871  +          free(zFake);
   870    872           }
   871    873           if( z ){
   872    874             sqlite3_result_text(pCtx, z, -1, sqlite3_free);
   873    875             return;
   874    876           }
   875    877         }
   876    878       }