Mesa (master): st/nine: Fix possible segfault in surface ctor
Axel Davy
axeldavy at kemper.freedesktop.org
Thu Oct 13 19:16:51 UTC 2016
Module: Mesa
Branch: master
Commit: 0717cd975d85eb04389d84c54b796863aa537cf0
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=0717cd975d85eb04389d84c54b796863aa537cf0
Author: Axel Davy <axel.davy at ens.fr>
Date: Wed Oct 12 19:10:53 2016 +0200
st/nine: Fix possible segfault in surface ctor
Regression introduced by
ba0274c7d6c3b77a36bbe1b444f427b0c873e2f3
Check the resource exists before assigning it
a flag (and use This->base.resource instead
of pResource, since the former may have a newly
allocate resource, while the latter would be
NULL).
This should reintroduce the behaviour of previous
code.
Signed-off-by: Axel Davy <axel.davy at ens.fr>
---
src/gallium/state_trackers/nine/surface9.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/gallium/state_trackers/nine/surface9.c b/src/gallium/state_trackers/nine/surface9.c
index dc31bb9..664b78f 100644
--- a/src/gallium/state_trackers/nine/surface9.c
+++ b/src/gallium/state_trackers/nine/surface9.c
@@ -187,8 +187,8 @@ NineSurface9_ctor( struct NineSurface9 *This,
This->stride = nine_format_get_stride(This->base.info.format, pDesc->Width);
- if (pDesc->Usage & D3DUSAGE_DYNAMIC)
- pResource->flags |= NINE_RESOURCE_FLAG_LOCKABLE;
+ if (This->base.resource && (pDesc->Usage & D3DUSAGE_DYNAMIC))
+ This->base.resource->flags |= NINE_RESOURCE_FLAG_LOCKABLE;
/* TODO: investigate what else exactly needs to be cleared */
if (This->base.resource && (pDesc->Usage & D3DUSAGE_RENDERTARGET)) {
More information about the mesa-commit
mailing list