diff options
author | Marcin Slusarz <[email protected]> | 2010-01-18 10:48:06 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2010-01-18 10:48:06 -0700 |
commit | e978b24c87be6d7572ed3272e6b186d5c54fb414 (patch) | |
tree | c2368621fd3b504aee092efd26657e1625dc495d /src/gallium/state_trackers/dri | |
parent | 23ae31820042f2bc4694f7c48696a697d674b802 (diff) |
st/dri: fix optionCache memory leaks
Signed-off-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/dri')
-rw-r--r-- | src/gallium/state_trackers/dri/dri_context.c | 6 | ||||
-rw-r--r-- | src/gallium/state_trackers/dri/dri_screen.c | 10 |
2 files changed, 16 insertions, 0 deletions
diff --git a/src/gallium/state_trackers/dri/dri_context.c b/src/gallium/state_trackers/dri/dri_context.c index 8819936fcaf..cd9d8b682eb 100644 --- a/src/gallium/state_trackers/dri/dri_context.c +++ b/src/gallium/state_trackers/dri/dri_context.c @@ -101,6 +101,12 @@ dri_destroy_context(__DRIcontextPrivate * cPriv) { struct dri_context *ctx = dri_context(cPriv); + /* note: we are freeing values and nothing more because + * driParseConfigFiles allocated values only - the rest + * is owned by screen optionCache. + */ + FREE(ctx->optionCache.values); + /* No particular reason to wait for command completion before * destroying a context, but it is probably worthwhile flushing it * to avoid having to add code elsewhere to cope with flushing a diff --git a/src/gallium/state_trackers/dri/dri_screen.c b/src/gallium/state_trackers/dri/dri_screen.c index 11ea28bcbe8..d95c62745e6 100644 --- a/src/gallium/state_trackers/dri/dri_screen.c +++ b/src/gallium/state_trackers/dri/dri_screen.c @@ -327,8 +327,18 @@ static void dri_destroy_screen(__DRIscreenPrivate * sPriv) { struct dri_screen *screen = dri_screen(sPriv); + int i; screen->pipe_screen->destroy(screen->pipe_screen); + + for (i = 0; i < (1 << screen->optionCache.tableSize); ++i) { + FREE(screen->optionCache.info[i].name); + FREE(screen->optionCache.info[i].ranges); + } + + FREE(screen->optionCache.info); + FREE(screen->optionCache.values); + FREE(screen); sPriv->private = NULL; } |