SQLite

Check-in [0e05355f3c]
Login

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

Overview
Comment:Make sure sqlite3FindCollSeq() returns NULL after a malloc() failure. (CVS 3134)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 0e05355f3ca795f0ab959553e6c9462e5483c3b2
User & Date: drh 2006-03-14 11:08:28.000
Context
2006-03-14
12:59
Move the PENDING_PAGE to a very large value if disk I/O is omitted. (CVS 3135) (check-in: f07181739f user: drh tags: trunk)
11:08
Make sure sqlite3FindCollSeq() returns NULL after a malloc() failure. (CVS 3134) (check-in: 0e05355f3c user: drh tags: trunk)
2006-03-13
15:06
Get parserless builds working again. (CVS 3133) (check-in: 5ddc09a5e4 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/callback.c.
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
**    May you share freely, never taking more than you give.
**
*************************************************************************
**
** This file contains functions used to access the internal hash tables
** of user defined functions and collation sequences.
**
** $Id: callback.c,v 1.13 2006/03/13 15:06:06 drh Exp $
*/

#include "sqliteInt.h"

/*
** Invoke the 'collation needed' callback to request a collation sequence
** in the database text encoding of name zName, length nName.







|







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
**    May you share freely, never taking more than you give.
**
*************************************************************************
**
** This file contains functions used to access the internal hash tables
** of user defined functions and collation sequences.
**
** $Id: callback.c,v 1.14 2006/03/14 11:08:28 drh Exp $
*/

#include "sqliteInt.h"

/*
** Invoke the 'collation needed' callback to request a collation sequence
** in the database text encoding of name zName, length nName.
174
175
176
177
178
179
180
181
182
183


184
185
186
187
188
189
190
      pColl[0].zName[nName] = 0;
      pDel = sqlite3HashInsert(&db->aCollSeq, pColl[0].zName, nName, pColl);

      /* If a malloc() failure occured in sqlite3HashInsert(), it will 
      ** return the pColl pointer to be deleted (because it wasn't added
      ** to the hash table).
      */
      assert( !pDel ||
              (sqlite3MallocFailed() && pDel==pColl) );
      sqliteFree(pDel);


    }
  }
  return pColl;
}

/*
** Parameter zName points to a UTF-8 encoded string nName bytes long.







|
|
|
>
>







174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
      pColl[0].zName[nName] = 0;
      pDel = sqlite3HashInsert(&db->aCollSeq, pColl[0].zName, nName, pColl);

      /* If a malloc() failure occured in sqlite3HashInsert(), it will 
      ** return the pColl pointer to be deleted (because it wasn't added
      ** to the hash table).
      */
      assert( !pDel || (sqlite3MallocFailed() && pDel==pColl) );
      if( pDel ){
        sqliteFree(pDel);
        pColl = 0;
      }
    }
  }
  return pColl;
}

/*
** Parameter zName points to a UTF-8 encoded string nName bytes long.