summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/nine/volume9.c
diff options
context:
space:
mode:
authorPatrick Rudolph <[email protected]>2015-05-13 19:43:04 +0200
committerAxel Davy <[email protected]>2015-08-21 22:21:46 +0200
commit48d895aa4b2475ef0af234b832d92d0ac4a47761 (patch)
treea33c4694aa31ca879ad4d557b241c15f05439425 /src/gallium/state_trackers/nine/volume9.c
parent74a77a4c1a5dafccbad0ff8c7fb55156c6643685 (diff)
st/nine: Return NULL pointer in lock error cases
Tests showed, that in case of errors, the pBits pointer is set to NULL. The pBits field isn't set to NULL in case of an already locked object. Reviewed-by: Axel Davy <[email protected]> Signed-off-by: Patrick Rudolph <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/nine/volume9.c')
-rw-r--r--src/gallium/state_trackers/nine/volume9.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/gallium/state_trackers/nine/volume9.c b/src/gallium/state_trackers/nine/volume9.c
index 549554843f9..63111037d9d 100644
--- a/src/gallium/state_trackers/nine/volume9.c
+++ b/src/gallium/state_trackers/nine/volume9.c
@@ -231,15 +231,19 @@ NineVolume9_LockBox( struct NineVolume9 *This,
pBox ? pBox->Front : 0, pBox ? pBox->Back : 0,
nine_D3DLOCK_to_str(Flags));
+ /* check if it's already locked */
+ user_assert(This->lock_count == 0, D3DERR_INVALIDCALL);
+
+ /* set pBits to NULL after lock_count check */
+ user_assert(pLockedVolume, E_POINTER);
+ pLockedVolume->pBits = NULL;
+
user_assert(This->desc.Pool != D3DPOOL_DEFAULT ||
(This->desc.Usage & D3DUSAGE_DYNAMIC), D3DERR_INVALIDCALL);
user_assert(!((Flags & D3DLOCK_DISCARD) && (Flags & D3DLOCK_READONLY)),
D3DERR_INVALIDCALL);
- user_assert(This->lock_count == 0, D3DERR_INVALIDCALL);
- user_assert(pLockedVolume, E_POINTER);
-
if (pBox && This->desc.Pool == D3DPOOL_DEFAULT &&
util_format_is_compressed(This->info.format)) {
const unsigned w = util_format_get_blockwidth(This->info.format);