• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

hardware/intel/libva


Commit MetaInfo

修订版2496bb03f3e70bcbee39ab84c1780ccbd57e97be (tree)
时间2009-07-08 18:42:05
作者Gwenole Beauchesne <gbeauchesne@spli...>
CommiterAustin Yuan

Log Message

Fix memory leak (VADriverContext.dri_state).

Signed-off-by: Austin Yuan <shengquan.yuan@intel.com>

更改概述

差异

--- a/src/x11/va_x11.c
+++ b/src/x11/va_x11.c
@@ -93,6 +93,7 @@ static void va_DisplayContextDestroy (
9393 }
9494 ctx = &((*ctx)->pNext);
9595 }
96+ free(pDisplayContext->pDriverContext->dri_state);
9697 free(pDisplayContext->pDriverContext);
9798 free(pDisplayContext);
9899 }
@@ -197,9 +198,11 @@ VADisplay vaGetDisplay (
197198 {
198199 /* create new entry */
199200 VADriverContextP pDriverContext;
201+ struct dri_state *dri_state;
200202 pDisplayContext = calloc(1, sizeof(*pDisplayContext));
201203 pDriverContext = calloc(1, sizeof(*pDriverContext));
202- if (pDisplayContext && pDriverContext)
204+ dri_state = calloc(1, sizeof(*dri_state));
205+ if (pDisplayContext && pDriverContext && dri_state)
203206 {
204207 pDriverContext->old_pNext = (void *)(unsigned long)0xdeadbeef;
205208 pDriverContext->x11_dpy = native_dpy;
@@ -209,7 +212,7 @@ VADisplay vaGetDisplay (
209212 pDisplayContext->vaDestroy = va_DisplayContextDestroy;
210213 pDisplayContext->vaGetDriverName = va_DisplayContextGetDriverName;
211214 pDisplayContexts = pDisplayContext;
212- pDriverContext->dri_state = calloc(1, sizeof(struct dri_state));
215+ pDriverContext->dri_state = dri_state;
213216 dpy = (VADisplay)pDisplayContext;
214217 }
215218 else
@@ -218,6 +221,8 @@ VADisplay vaGetDisplay (
218221 free(pDisplayContext);
219222 if (pDriverContext)
220223 free(pDriverContext);
224+ if (dri_state)
225+ free(dri_state);
221226 }
222227 }
223228