diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2018-05-15 19:58:14 +0100 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2018-05-18 09:14:24 +0200 |
commit | e8dcb8ae5121965ac8c89e6b277ac127e9d08452 (patch) | |
tree | ff2a8f5e8d90ae1cc581a63230e4778b4050f3c0 /ui | |
parent | 68898bc82bcb0e697ed03c2405321033ba7feaf7 (diff) | |
download | qemu-e8dcb8ae5121965ac8c89e6b277ac127e9d08452.zip qemu-e8dcb8ae5121965ac8c89e6b277ac127e9d08452.tar.gz qemu-e8dcb8ae5121965ac8c89e6b277ac127e9d08452.tar.bz2 |
sdl: Move use of surface pointer below check for whether it is NULL
In commit 2ab858c6c38ee1 we added a use of the 'surf' variable
in sdl2_2d_update() that was unfortunately placed above the
early-exit-if-NULL check. Move it to where it ought to be.
Fixes: Coverity CID 1390598
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-id: 20180515185814.1374-1-peter.maydell@linaro.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'ui')
-rw-r--r-- | ui/sdl2-2d.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/ui/sdl2-2d.c b/ui/sdl2-2d.c index 1f34817..8548440 100644 --- a/ui/sdl2-2d.c +++ b/ui/sdl2-2d.c @@ -36,9 +36,7 @@ void sdl2_2d_update(DisplayChangeListener *dcl, struct sdl2_console *scon = container_of(dcl, struct sdl2_console, dcl); DisplaySurface *surf = qemu_console_surface(dcl->con); SDL_Rect rect; - size_t surface_data_offset = surface_bytes_per_pixel(surf) * x + - surface_stride(surf) * y; - + size_t surface_data_offset; assert(!scon->opengl); if (!surf) { @@ -48,6 +46,8 @@ void sdl2_2d_update(DisplayChangeListener *dcl, return; } + surface_data_offset = surface_bytes_per_pixel(surf) * x + + surface_stride(surf) * y; rect.x = x; rect.y = y; rect.w = w; |