SQLite

Check-in [d4ab94288b]
Login

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

Overview
Comment:Fix an obscure memory leak in the SQL compiler.. (CVS 4070)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: d4ab94288b1e3d3d069ccc75d0fc2fbe6c1383c5
User & Date: danielk1977 2007-06-15 16:37:29.000
Context
2007-06-15
17:03
Fix a memory leak in the parser that can occur following a malloc failure. (CVS 4071) (check-in: d0b6e9a07e user: drh tags: trunk)
16:37
Fix an obscure memory leak in the SQL compiler.. (CVS 4070) (check-in: d4ab94288b user: danielk1977 tags: trunk)
15:31
Fix a memory leak that was discovered by the tests that were added to cover ticket #2339. (CVS 4069) (check-in: 1d10a48934 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/expr.c.
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains routines used for analyzing expressions and
** for generating VDBE code that evaluates expressions in SQLite.
**
** $Id: expr.c,v 1.297 2007/06/08 00:20:48 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>

/*
** Return the 'affinity' of the expression pExpr if any.
**







|







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains routines used for analyzing expressions and
** for generating VDBE code that evaluates expressions in SQLite.
**
** $Id: expr.c,v 1.298 2007/06/15 16:37:29 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>

/*
** Return the 'affinity' of the expression pExpr if any.
**
1143
1144
1145
1146
1147
1148
1149


1150
1151
1152
1153
1154
1155
1156
          assert( pExpr->pList==0 );
          assert( pExpr->pSelect==0 );
          pDup = sqlite3ExprDup(pEList->a[j].pExpr);
          if( pExpr->flags & EP_ExpCollate ){
            pDup->pColl = pExpr->pColl;
            pDup->flags |= EP_ExpCollate;
          }


          memcpy(pExpr, pDup, sizeof(*pExpr));
          sqliteFree(pDup);
          cnt = 1;
          assert( zTab==0 && zDb==0 );
          goto lookupname_end_2;
        }
      } 







>
>







1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
          assert( pExpr->pList==0 );
          assert( pExpr->pSelect==0 );
          pDup = sqlite3ExprDup(pEList->a[j].pExpr);
          if( pExpr->flags & EP_ExpCollate ){
            pDup->pColl = pExpr->pColl;
            pDup->flags |= EP_ExpCollate;
          }
          if( pExpr->span.dyn ) sqliteFree((char*)pExpr->span.z);
          if( pExpr->token.dyn ) sqliteFree((char*)pExpr->token.z);
          memcpy(pExpr, pDup, sizeof(*pExpr));
          sqliteFree(pDup);
          cnt = 1;
          assert( zTab==0 && zDb==0 );
          goto lookupname_end_2;
        }
      }