mirror of
https://github.com/SELinuxProject/selinux
synced 2025-02-17 10:06:51 +00:00
Check strdup() failure
This commit is contained in:
parent
cd1ef4d64e
commit
baf8a1de16
@ -27,6 +27,11 @@ int main(int argc, char **argv)
|
|||||||
switch (opt) {
|
switch (opt) {
|
||||||
case 'l':
|
case 'l':
|
||||||
level = strdup(optarg);
|
level = strdup(optarg);
|
||||||
|
if (!level) {
|
||||||
|
fprintf(stderr, "memory allocation failure: %d(%s)\n",
|
||||||
|
errno, strerror(errno));
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
usage(argv[0], "invalid option", 1);
|
usage(argv[0], "invalid option", 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user