diff options
| author | Derek Foreman <derekf@osg.samsung.com> | 2015-11-05 13:57:47 -0600 |
|---|---|---|
| committer | Pekka Paalanen <pekka.paalanen@collabora.co.uk> | 2015-11-06 13:42:52 +0200 |
| commit | 8bc42fbf7bb53f4942c50be10be572ee479bab0f (patch) | |
| tree | 6816209a46ac751bf015b2cf1e6d60b2f5b0d840 /src/wayland-shm.c | |
| parent | shm: Move deprecated function to the bottom of the file (diff) | |
| download | wayland-8bc42fbf7bb53f4942c50be10be572ee479bab0f.tar wayland-8bc42fbf7bb53f4942c50be10be572ee479bab0f.tar.gz wayland-8bc42fbf7bb53f4942c50be10be572ee479bab0f.tar.bz2 wayland-8bc42fbf7bb53f4942c50be10be572ee479bab0f.tar.lz wayland-8bc42fbf7bb53f4942c50be10be572ee479bab0f.tar.xz wayland-8bc42fbf7bb53f4942c50be10be572ee479bab0f.tar.zst wayland-8bc42fbf7bb53f4942c50be10be572ee479bab0f.zip | |
shm: wl_shm_buffer_get_data() requires a valid pool.
There's no situation where a shm buffer without a pool makes sense,
so we enforce the pool's existence a little more rigidly.
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Giulio Camuffo <giuliocamuffo@gmail.com>
Diffstat (limited to 'src/wayland-shm.c')
| -rw-r--r-- | src/wayland-shm.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/wayland-shm.c b/src/wayland-shm.c index db23909..0cd8c11 100644 --- a/src/wayland-shm.c +++ b/src/wayland-shm.c @@ -353,10 +353,12 @@ wl_shm_buffer_get_stride(struct wl_shm_buffer *buffer) WL_EXPORT void * wl_shm_buffer_get_data(struct wl_shm_buffer *buffer) { - if (buffer->pool) - return buffer->pool->data + buffer->offset; - else - return buffer + 1; + assert(buffer->pool); + + if (!buffer->pool) + return NULL; + + return buffer->pool->data + buffer->offset; } WL_EXPORT uint32_t |
