[Issue#] prevent - #14493
[Bug] Resource leak (RESOURCE_LEAK)
[Cause] Bug.
[Solution] Release unhandled resource.
Change-Id: Ib52dcf3cb5aa2e8e4b5e241ce00e954e2bb7611e
/* or permission error by using 'emulator', bypass*/
if((errno != EOPNOTSUPP) && (errno != EPERM)) {
_E("labeling to socket(IPOUT) error");
+ close(fd);
return -1;
}
}
/* or permission error by using 'emulator', bypass*/
if((errno != EOPNOTSUPP) && (errno != EPERM)) {
_E("labeling to socket(IPIN) error");
+ close(fd);
return -1;
}
}
if (bind(fd, (struct sockaddr *)&saddr, sizeof(saddr)) < 0) {
_E("bind error");
+ close(fd);
return -1;
}
if (chmod(saddr.sun_path, (S_IRWXU | S_IRWXG | S_IRWXO)) < 0) {
/* Flawfinder: ignore*/
_E("failed to change the socket permission");
+ close(fd);
return -1;
}