2012-05-29 15:17:02 +00:00
|
|
|
diff --git a/libsemanage/src/fcontext_record.c b/libsemanage/src/fcontext_record.c
|
|
|
|
index ec02a89..3f9d893 100644
|
|
|
|
--- a/libsemanage/src/fcontext_record.c
|
|
|
|
+++ b/libsemanage/src/fcontext_record.c
|
|
|
|
@@ -45,7 +45,11 @@ int semanage_fcontext_key_create(semanage_handle_t * handle,
|
|
|
|
"create file context key");
|
|
|
|
return STATUS_ERR;
|
|
|
|
}
|
|
|
|
- tmp_key->expr = expr;
|
|
|
|
+ tmp_key->expr = strdup(expr);
|
|
|
|
+ if (!tmp_key->expr) {
|
|
|
|
+ ERR(handle, "out of memory, could not create file context key.");
|
|
|
|
+ return STATUS_ERR;
|
|
|
|
+ }
|
|
|
|
tmp_key->type = type;
|
|
|
|
|
|
|
|
*key_ptr = tmp_key;
|
|
|
|
@@ -74,6 +78,7 @@ hidden_def(semanage_fcontext_key_extract)
|
|
|
|
|
|
|
|
void semanage_fcontext_key_free(semanage_fcontext_key_t * key)
|
|
|
|
{
|
|
|
|
+ free(key->expr);
|
|
|
|
free(key);
|
|
|
|
}
|
|
|
|
|
2012-01-06 14:19:58 +00:00
|
|
|
diff --git a/libsemanage/src/handle.c b/libsemanage/src/handle.c
|
2012-03-29 19:28:29 +00:00
|
|
|
index 4b43ba7..7fcd2b4 100644
|
2012-01-06 14:19:58 +00:00
|
|
|
--- a/libsemanage/src/handle.c
|
|
|
|
+++ b/libsemanage/src/handle.c
|
2012-03-29 19:28:29 +00:00
|
|
|
@@ -186,7 +186,8 @@ const char *semanage_selinux_path(void) {
|
2012-01-06 14:19:58 +00:00
|
|
|
|
2012-03-29 19:28:29 +00:00
|
|
|
const char *semanage_conf_path(void)
|
|
|
|
{
|
|
|
|
- if (private_semanage_conf_path)
|
2012-01-06 14:19:58 +00:00
|
|
|
+ if (private_semanage_conf_path &&
|
|
|
|
+ access(private_semanage_conf_path, R_OK) == 0)
|
2012-03-29 19:28:29 +00:00
|
|
|
return private_semanage_conf_path;
|
2012-01-06 14:19:58 +00:00
|
|
|
|
2012-03-29 19:28:29 +00:00
|
|
|
return SEMANAGE_CONF_PATH;
|