Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Unified Diff: third_party/sqlite/src/ext/misc/compress.c

Issue 1610963002: Import SQLite 3.10.2. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/sqlite/src/ext/misc/closure.c ('k') | third_party/sqlite/src/ext/misc/eval.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/sqlite/src/ext/misc/compress.c
diff --git a/third_party/sqlite/src/ext/misc/compress.c b/third_party/sqlite/src/ext/misc/compress.c
index a4059116c9e4c981b1345fca9bb9c0edf35dcb4b..bf38d4c93cfeff2785c2bf6ff523e6f745d3a113 100644
--- a/third_party/sqlite/src/ext/misc/compress.c
+++ b/third_party/sqlite/src/ext/misc/compress.c
@@ -38,6 +38,7 @@ static void compressFunc(
unsigned int nIn;
unsigned long int nOut;
unsigned char x[8];
+ int rc;
int i, j;
pIn = sqlite3_value_blob(argv[0]);
@@ -50,8 +51,12 @@ static void compressFunc(
for(i=0; i<4 && x[i]==0; i++){}
for(j=0; i<=4; i++, j++) pOut[j] = x[i];
pOut[j-1] |= 0x80;
- compress(&pOut[j], &nOut, pIn, nIn);
- sqlite3_result_blob(context, pOut, nOut+j, sqlite3_free);
+ rc = compress(&pOut[j], &nOut, pIn, nIn);
+ if( rc==Z_OK ){
+ sqlite3_result_blob(context, pOut, nOut+j, sqlite3_free);
+ }else{
+ sqlite3_free(pOut);
+ }
}
/*
@@ -82,6 +87,8 @@ static void uncompressFunc(
rc = uncompress(pOut, &nOut, &pIn[i], nIn-i);
if( rc==Z_OK ){
sqlite3_result_blob(context, pOut, nOut, sqlite3_free);
+ }else{
+ sqlite3_free(pOut);
}
}
« no previous file with comments | « third_party/sqlite/src/ext/misc/closure.c ('k') | third_party/sqlite/src/ext/misc/eval.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698