util: set errno in wl_map_insert_at()

And add errno checks in callers, where it seems to be necessary.

Signed-off-by: Aleksandr Mezin <mezin.alexander@gmail.com>
This commit is contained in:
Aleksandr Mezin 2022-02-09 05:36:11 +06:00 committed by Simon Ser
parent 03e8a1f84b
commit 884d5fe3ab
3 changed files with 18 additions and 9 deletions

View file

@ -485,7 +485,10 @@ wl_proxy_create_for_id(struct wl_proxy *factory,
proxy->refcount = 1;
proxy->version = factory->version;
wl_map_insert_at(&display->objects, 0, id, proxy);
if (wl_map_insert_at(&display->objects, 0, id, proxy) == -1) {
free(proxy);
return NULL;
}
return proxy;
}