# HG changeset patch # User michael # Date 1211921307 0 # Node ID 7b34cd9dfe852418f74b70bdec7462348ce5c03f # Parent 7db242158d51fa47c50064860dff0cabdc9b3b35 Fix memleak, fixed CID123. diff -r 7db242158d51 -r 7b34cd9dfe85 nutdec.c --- a/nutdec.c Tue May 27 18:43:25 2008 +0000 +++ b/nutdec.c Tue May 27 20:48:27 2008 +0000 @@ -500,6 +500,7 @@ int64_t filesize= url_fsize(bc); int64_t *syncpoints; int8_t *has_keyframe; + int ret= -1; url_fseek(bc, filesize-12, SEEK_SET); url_fseek(bc, filesize-get_be64(bc), SEEK_SET); @@ -516,7 +517,9 @@ syncpoints= av_malloc(sizeof(int64_t)*syncpoint_count); has_keyframe= av_malloc(sizeof(int8_t)*(syncpoint_count+1)); for(i=0; i0) + syncpoints[i] = ff_get_v(bc); + if(syncpoints[i] <= 0) + goto fail; if(i) syncpoints[i] += syncpoints[i-1]; } @@ -533,7 +536,7 @@ x>>=1; if(n+x >= syncpoint_count + 1){ av_log(s, AV_LOG_ERROR, "index overflow A\n"); - return -1; + goto fail; } while(x--) has_keyframe[n++]= flag; @@ -542,7 +545,7 @@ while(x != 1){ if(n>=syncpoint_count + 1){ av_log(s, AV_LOG_ERROR, "index overflow B\n"); - return -1; + goto fail; } has_keyframe[n++]= x&1; x>>=1; @@ -550,7 +553,7 @@ } if(has_keyframe[0]){ av_log(s, AV_LOG_ERROR, "keyframe before first syncpoint in index\n"); - return -1; + goto fail; } assert(n<=syncpoint_count+1); for(; j