SQLite

Check-in [5372f80083]
Login

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

Overview
Comment:Modify the order of terms in an "if" condition to avoid implicitly comparing a dangling pointer to NULL following an OOM error.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 5372f800835da61736a64dcee8b476bbe7ee2e46
User & Date: dan 2016-01-28 18:22:46.091
Context
2016-01-29
08:38
Avoid two more instances of pointer arithmetic on freed pointers. (check-in: 2910ef6409 user: dan tags: trunk)
2016-01-28
18:22
Modify the order of terms in an "if" condition to avoid implicitly comparing a dangling pointer to NULL following an OOM error. (check-in: 5372f80083 user: dan tags: trunk)
08:58
Remove a duplicate "p->magic = VDBE_MAGIC_RUN;" line from vdbeaux.c. (check-in: 688eb3b400 user: dan tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/parse.y.
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
expr(A) ::= expr(X) NOT NULL(E). {spanUnaryPostfix(&A,pParse,TK_NOTNULL,&X,&E);}

%include {
  /* A routine to convert a binary TK_IS or TK_ISNOT expression into a
  ** unary TK_ISNULL or TK_NOTNULL expression. */
  static void binaryToUnaryIfNull(Parse *pParse, Expr *pY, Expr *pA, int op){
    sqlite3 *db = pParse->db;
    if( pY && pA && pY->op==TK_NULL ){
      pA->op = (u8)op;
      sqlite3ExprDelete(db, pA->pRight);
      pA->pRight = 0;
    }
  }
}








|







1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
expr(A) ::= expr(X) NOT NULL(E). {spanUnaryPostfix(&A,pParse,TK_NOTNULL,&X,&E);}

%include {
  /* A routine to convert a binary TK_IS or TK_ISNOT expression into a
  ** unary TK_ISNULL or TK_NOTNULL expression. */
  static void binaryToUnaryIfNull(Parse *pParse, Expr *pY, Expr *pA, int op){
    sqlite3 *db = pParse->db;
    if( pA && pY && pY->op==TK_NULL ){
      pA->op = (u8)op;
      sqlite3ExprDelete(db, pA->pRight);
      pA->pRight = 0;
    }
  }
}