mirror of
https://gitlab.freedesktop.org/libinput/libei.git
synced 2026-05-14 18:08:12 +02:00
util: return NULL in memmap_new() for a size 0
Assisted-by: Claude:claude-opus-4-6 Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/388>
This commit is contained in:
parent
bacd62cae0
commit
4440f15453
1 changed files with 3 additions and 0 deletions
|
|
@ -55,6 +55,9 @@ OBJECT_IMPLEMENT_GETTER(memmap, data, void *);
|
|||
struct memmap *
|
||||
memmap_new(int fd, size_t sz)
|
||||
{
|
||||
if (sz == 0)
|
||||
return NULL;
|
||||
|
||||
_unref_(memmap) *memmap = memmap_create(NULL);
|
||||
|
||||
void *map = mmap(NULL, sz, PROT_READ, MAP_PRIVATE, fd, 0);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue