summaryrefslogtreecommitdiff
path: root/ext/pdo_sqlite/sqlite/src/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/pdo_sqlite/sqlite/src/util.c')
-rw-r--r--ext/pdo_sqlite/sqlite/src/util.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/ext/pdo_sqlite/sqlite/src/util.c b/ext/pdo_sqlite/sqlite/src/util.c
index a35a43fce3..de716d9820 100644
--- a/ext/pdo_sqlite/sqlite/src/util.c
+++ b/ext/pdo_sqlite/sqlite/src/util.c
@@ -367,6 +367,19 @@ char *sqlite3StrNDup(const char *z, int n){
#endif /* !defined(SQLITE_MEMDEBUG) */
/*
+** 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