mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
shm: Make sure to not allocate blocks larger than the shared mem area
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=681359
This commit is contained in:
parent
a51b239167
commit
7a77b41d6a
1 changed files with 5 additions and 7 deletions
|
@ -102,13 +102,11 @@ shm_alloc_space_alloc_block (ShmAllocSpace * self, unsigned long size)
|
|||
prev_item = item;
|
||||
}
|
||||
|
||||
/* Did not find space before an existing block */
|
||||
if (self->blocks && !item) {
|
||||
/* Return NULL if there is no big enough space, otherwise, there is space
|
||||
* at the end */
|
||||
if (self->size - prev_end_offset < size)
|
||||
return NULL;
|
||||
}
|
||||
/* Return NULL if there is no big enough space, otherwise, there is space
|
||||
* at the end */
|
||||
assert (prev_end_offset <= self->size);
|
||||
if (!item && self->size - prev_end_offset < size)
|
||||
return NULL;
|
||||
|
||||
block = spalloc_new (ShmAllocBlock);
|
||||
memset (block, 0, sizeof (ShmAllocBlock));
|
||||
|
|
Loading…
Reference in a new issue