Mercurial > libavcodec.hg
comparison dv.c @ 2845:d9f4b93e81c5 libavcodec
Fix for memleak in dv.c patch by (Burkhard Plaum; plaum, ipf uni-stuttgart de)
author | michael |
---|---|
date | Fri, 26 Aug 2005 15:41:28 +0000 |
parents | fdedaa2e6da4 |
children | 712c84b9d8ce |
comparison
equal
deleted
inserted
replaced
2844:5f20ab245501 | 2845:d9f4b93e81c5 |
---|---|
107 uint8_t new_dv_vlc_run[NB_DV_VLC*2]; | 107 uint8_t new_dv_vlc_run[NB_DV_VLC*2]; |
108 int16_t new_dv_vlc_level[NB_DV_VLC*2]; | 108 int16_t new_dv_vlc_level[NB_DV_VLC*2]; |
109 | 109 |
110 done = 1; | 110 done = 1; |
111 | 111 |
112 dv_vlc_map = av_mallocz(DV_VLC_MAP_LEV_SIZE*DV_VLC_MAP_RUN_SIZE*sizeof(struct dv_vlc_pair)); | 112 dv_vlc_map = av_mallocz_static(DV_VLC_MAP_LEV_SIZE*DV_VLC_MAP_RUN_SIZE*sizeof(struct dv_vlc_pair)); |
113 if (!dv_vlc_map) | 113 if (!dv_vlc_map) |
114 return -ENOMEM; | 114 return -ENOMEM; |
115 | 115 |
116 /* dv_anchor lets each thread know its Id */ | 116 /* dv_anchor lets each thread know its Id */ |
117 dv_anchor = av_malloc(12*27*sizeof(void*)); | 117 dv_anchor = av_malloc(12*27*sizeof(void*)); |
118 if (!dv_anchor) { | 118 if (!dv_anchor) { |
119 av_free(dv_vlc_map); | |
120 return -ENOMEM; | 119 return -ENOMEM; |
121 } | 120 } |
122 for (i=0; i<12*27; i++) | 121 for (i=0; i<12*27; i++) |
123 dv_anchor[i] = (void*)(size_t)i; | 122 dv_anchor[i] = (void*)(size_t)i; |
124 | 123 |
147 new_dv_vlc_len, 1, 1, new_dv_vlc_bits, 2, 2, 0); | 146 new_dv_vlc_len, 1, 1, new_dv_vlc_bits, 2, 2, 0); |
148 | 147 |
149 dv_rl_vlc = av_malloc(dv_vlc.table_size * sizeof(RL_VLC_ELEM)); | 148 dv_rl_vlc = av_malloc(dv_vlc.table_size * sizeof(RL_VLC_ELEM)); |
150 if (!dv_rl_vlc) { | 149 if (!dv_rl_vlc) { |
151 av_free(dv_anchor); | 150 av_free(dv_anchor); |
152 av_free(dv_vlc_map); | |
153 return -ENOMEM; | 151 return -ENOMEM; |
154 } | 152 } |
155 for(i = 0; i < dv_vlc.table_size; i++){ | 153 for(i = 0; i < dv_vlc.table_size; i++){ |
156 int code= dv_vlc.table[i][0]; | 154 int code= dv_vlc.table[i][0]; |
157 int len = dv_vlc.table[i][1]; | 155 int len = dv_vlc.table[i][1]; |