hardware/intel/libva
修订版 | 2496bb03f3e70bcbee39ab84c1780ccbd57e97be (tree) |
---|---|
时间 | 2009-07-08 18:42:05 |
作者 | Gwenole Beauchesne <gbeauchesne@spli...> |
Commiter | Austin Yuan |
Fix memory leak (VADriverContext.dri_state).
Signed-off-by: Austin Yuan <shengquan.yuan@intel.com>
@@ -93,6 +93,7 @@ static void va_DisplayContextDestroy ( | ||
93 | 93 | } |
94 | 94 | ctx = &((*ctx)->pNext); |
95 | 95 | } |
96 | + free(pDisplayContext->pDriverContext->dri_state); | |
96 | 97 | free(pDisplayContext->pDriverContext); |
97 | 98 | free(pDisplayContext); |
98 | 99 | } |
@@ -197,9 +198,11 @@ VADisplay vaGetDisplay ( | ||
197 | 198 | { |
198 | 199 | /* create new entry */ |
199 | 200 | VADriverContextP pDriverContext; |
201 | + struct dri_state *dri_state; | |
200 | 202 | pDisplayContext = calloc(1, sizeof(*pDisplayContext)); |
201 | 203 | pDriverContext = calloc(1, sizeof(*pDriverContext)); |
202 | - if (pDisplayContext && pDriverContext) | |
204 | + dri_state = calloc(1, sizeof(*dri_state)); | |
205 | + if (pDisplayContext && pDriverContext && dri_state) | |
203 | 206 | { |
204 | 207 | pDriverContext->old_pNext = (void *)(unsigned long)0xdeadbeef; |
205 | 208 | pDriverContext->x11_dpy = native_dpy; |
@@ -209,7 +212,7 @@ VADisplay vaGetDisplay ( | ||
209 | 212 | pDisplayContext->vaDestroy = va_DisplayContextDestroy; |
210 | 213 | pDisplayContext->vaGetDriverName = va_DisplayContextGetDriverName; |
211 | 214 | pDisplayContexts = pDisplayContext; |
212 | - pDriverContext->dri_state = calloc(1, sizeof(struct dri_state)); | |
215 | + pDriverContext->dri_state = dri_state; | |
213 | 216 | dpy = (VADisplay)pDisplayContext; |
214 | 217 | } |
215 | 218 | else |
@@ -218,6 +221,8 @@ VADisplay vaGetDisplay ( | ||
218 | 221 | free(pDisplayContext); |
219 | 222 | if (pDriverContext) |
220 | 223 | free(pDriverContext); |
224 | + if (dri_state) | |
225 | + free(dri_state); | |
221 | 226 | } |
222 | 227 | } |
223 | 228 |