Found by Coverity.
Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Fixes: ef5266ebd50 ("util/os_socket: Add socket related functions.")
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6067>
int ret = bind(s, (struct sockaddr*)&addr,
offsetof(struct sockaddr_un, sun_path) +
strlen(path) + 1);
- if (ret < 0)
+ if (ret < 0) {
+ close(s);
return -1;
+ }
- listen(s, count);
+ if (listen(s, count) < 0) {
+ close(s);
+ return -1;
+ }
return s;
}