diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/func.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/func.c b/src/func.c index 5e4b418d5..2403b3d56 100644 --- a/src/func.c +++ b/src/func.c @@ -16,7 +16,7 @@ ** sqliteRegisterBuildinFunctions() found at the bottom of the file. ** All other code has file scope. ** -** $Id: func.c,v 1.145 2007/05/04 13:15:56 drh Exp $ +** $Id: func.c,v 1.146 2007/05/07 19:31:16 drh Exp $ */ #include "sqliteInt.h" #include <ctype.h> @@ -297,9 +297,11 @@ static void randomBlob( assert( argc==1 ); n = sqlite3_value_int(argv[0]); if( n<1 ) n = 1; - p = sqlite3_malloc(n); - sqlite3Randomness(n, p); - sqlite3_result_blob(context, (char*)p, n, sqlite3_free); + p = sqliteMalloc(n); + if( p ){ + sqlite3Randomness(n, p); + sqlite3_result_blob(context, (char*)p, n, sqlite3FreeX); + } } /* |