mirror of
https://github.com/SELinuxProject/selinux
synced 2024-12-28 00:42:07 +00:00
libsemanage: fixes from coverity
Signed-off-by: Eric Paris <eparis@redhat.com> Acked-by: Dan Walsh <dwalsh@redhat.com>
This commit is contained in:
parent
c27a54775d
commit
2276a2fa51
@ -369,9 +369,11 @@ int dbase_llist_list(semanage_handle_t * handle,
|
||||
ERR(handle, "out of memory");
|
||||
|
||||
err:
|
||||
for (; i >= 0; i--)
|
||||
dbase->rtable->free(tmp_records[i]);
|
||||
free(tmp_records);
|
||||
if (tmp_records) {
|
||||
for (; i >= 0; i--)
|
||||
dbase->rtable->free(tmp_records[i]);
|
||||
free(tmp_records);
|
||||
}
|
||||
ERR(handle, "could not allocate record array");
|
||||
return STATUS_ERR;
|
||||
}
|
||||
|
@ -462,9 +462,11 @@ static int dbase_policydb_list(semanage_handle_t * handle,
|
||||
ERR(handle, "out of memory");
|
||||
|
||||
err:
|
||||
for (; list_arg.pos >= 0; list_arg.pos--)
|
||||
dbase->rtable->free(tmp_records[list_arg.pos]);
|
||||
free(tmp_records);
|
||||
if (tmp_records) {
|
||||
for (; list_arg.pos >= 0; list_arg.pos--)
|
||||
dbase->rtable->free(tmp_records[list_arg.pos]);
|
||||
free(tmp_records);
|
||||
}
|
||||
ERR(handle, "could not list records");
|
||||
return STATUS_ERR;
|
||||
}
|
||||
|
@ -62,11 +62,12 @@ void hidden semanage_msg_default_handler(void *varg __attribute__ ((unused)),
|
||||
switch (semanage_msg_get_level(handle)) {
|
||||
|
||||
case SEMANAGE_MSG_ERR:
|
||||
stream = stderr;
|
||||
errsv = errno;
|
||||
break;
|
||||
case SEMANAGE_MSG_WARN:
|
||||
stream = stderr;
|
||||
break;
|
||||
case SEMANAGE_MSG_INFO:
|
||||
default:
|
||||
stream = stdout;
|
||||
break;
|
||||
|
@ -1061,7 +1061,7 @@ int semanage_split_fc(semanage_handle_t * sh)
|
||||
}
|
||||
hd = open(semanage_path(SEMANAGE_TMP, SEMANAGE_HOMEDIR_TMPL),
|
||||
O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR);
|
||||
if (!hd) {
|
||||
if (hd < 0) {
|
||||
ERR(sh, "Could not open %s for writing.",
|
||||
semanage_path(SEMANAGE_TMP, SEMANAGE_HOMEDIR_TMPL));
|
||||
goto cleanup;
|
||||
|
Loading…
Reference in New Issue
Block a user