SQLite

Check-in [0e85af44fa]
Login

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

Overview
Comment:The sqlite3ReallocOrFree routine should set its pointer to NULL when it fails. (CVS 2715)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 0e85af44faca4b625e6ab7cb21a300867298c539
User & Date: drh 2005-09-17 18:34:11.000
Context
2005-09-17
18:49
Version 3.2.6 (CVS 2716) (check-in: 1cdfe66714 user: drh tags: trunk)
18:34
The sqlite3ReallocOrFree routine should set its pointer to NULL when it fails. (CVS 2715) (check-in: 0e85af44fa user: drh tags: trunk)
18:02
Fix up the busy test so that it can be run multiple times in a row without giving false errors on 2nd and subsequent runs. (CVS 2714) (check-in: 7a7ba73fb5 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/util.c.
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
**
*************************************************************************
** Utility functions used throughout sqlite.
**
** This file contains functions for allocating memory, comparing
** strings, and stuff like that.
**
** $Id: util.c,v 1.145 2005/09/16 02:38:11 drh Exp $
*/
#include "sqliteInt.h"
#include <stdarg.h>
#include <ctype.h>

#if SQLITE_MEMDEBUG>2 && defined(__GLIBC__)
#include <execinfo.h>







|







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
**
*************************************************************************
** Utility functions used throughout sqlite.
**
** This file contains functions for allocating memory, comparing
** strings, and stuff like that.
**
** $Id: util.c,v 1.146 2005/09/17 18:34:11 drh Exp $
*/
#include "sqliteInt.h"
#include <stdarg.h>
#include <ctype.h>

#if SQLITE_MEMDEBUG>2 && defined(__GLIBC__)
#include <execinfo.h>
369
370
371
372
373
374
375
376
377
378
379
380

381
382
383
384
385
386
387
/*
** Reallocate a buffer to a different size.  This is similar to
** sqliteRealloc() except that if the allocation fails the buffer
** is freed.
*/
void sqlite3ReallocOrFree(void **ppBuf, int newSize){
  void *pNew = sqliteRealloc(*ppBuf, newSize);
  if( pNew ){
    *ppBuf = pNew;
  }else{
    sqliteFree(*ppBuf);
  }

}

/*
** Create a string from the 2nd and subsequent arguments (up to the
** first NULL argument), store the string in memory obtained from
** sqliteMalloc() and make the pointer indicated by the 1st argument
** point to that string.  The 1st argument must either be NULL or 







|
<
<


>







369
370
371
372
373
374
375
376


377
378
379
380
381
382
383
384
385
386
/*
** Reallocate a buffer to a different size.  This is similar to
** sqliteRealloc() except that if the allocation fails the buffer
** is freed.
*/
void sqlite3ReallocOrFree(void **ppBuf, int newSize){
  void *pNew = sqliteRealloc(*ppBuf, newSize);
  if( pNew==0 ){


    sqliteFree(*ppBuf);
  }
  *ppBuf = pNew;
}

/*
** Create a string from the 2nd and subsequent arguments (up to the
** first NULL argument), store the string in memory obtained from
** sqliteMalloc() and make the pointer indicated by the 1st argument
** point to that string.  The 1st argument must either be NULL or