Fossil SCM

Check the return code form blob_delta_apply() to make sure there are no errors prior to using the result.

drh 2016-04-19 03:16 trunk
Commit 85fc2e0a4801349657df46b4e75a343b8cc98c27
1 file changed +9 -6
+9 -6
--- src/content.c
+++ src/content.c
@@ -282,18 +282,21 @@
282282
rc = content_get(a[n], pBlob);
283283
n--;
284284
while( rc && n>=0 ){
285285
rc = content_of_blob(a[n], &delta);
286286
if( rc ){
287
- blob_delta_apply(pBlob, &delta, &next);
288
- blob_reset(&delta);
289
- if( (mx-n)%8==0 ){
290
- content_cache_insert(a[n+1], pBlob);
287
+ if( blob_delta_apply(pBlob, &delta, &next)<0 ){
288
+ rc = 1;
291289
}else{
292
- blob_reset(pBlob);
290
+ blob_reset(&delta);
291
+ if( (mx-n)%8==0 ){
292
+ content_cache_insert(a[n+1], pBlob);
293
+ }else{
294
+ blob_reset(pBlob);
295
+ }
296
+ *pBlob = next;
293297
}
294
- *pBlob = next;
295298
}
296299
n--;
297300
}
298301
free(a);
299302
if( !rc ) blob_reset(pBlob);
300303
--- src/content.c
+++ src/content.c
@@ -282,18 +282,21 @@
282 rc = content_get(a[n], pBlob);
283 n--;
284 while( rc && n>=0 ){
285 rc = content_of_blob(a[n], &delta);
286 if( rc ){
287 blob_delta_apply(pBlob, &delta, &next);
288 blob_reset(&delta);
289 if( (mx-n)%8==0 ){
290 content_cache_insert(a[n+1], pBlob);
291 }else{
292 blob_reset(pBlob);
 
 
 
 
 
 
293 }
294 *pBlob = next;
295 }
296 n--;
297 }
298 free(a);
299 if( !rc ) blob_reset(pBlob);
300
--- src/content.c
+++ src/content.c
@@ -282,18 +282,21 @@
282 rc = content_get(a[n], pBlob);
283 n--;
284 while( rc && n>=0 ){
285 rc = content_of_blob(a[n], &delta);
286 if( rc ){
287 if( blob_delta_apply(pBlob, &delta, &next)<0 ){
288 rc = 1;
 
 
289 }else{
290 blob_reset(&delta);
291 if( (mx-n)%8==0 ){
292 content_cache_insert(a[n+1], pBlob);
293 }else{
294 blob_reset(pBlob);
295 }
296 *pBlob = next;
297 }
 
298 }
299 n--;
300 }
301 free(a);
302 if( !rc ) blob_reset(pBlob);
303

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button