mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-23 09:28:54 +02:00
gio: remove unnecessary strdup and fix potential leak
setfilecon_raw() takes a const argument since libselinux 2.2 (commit
6a17cfaafc
)
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
This commit is contained in:
@@ -2715,11 +2715,7 @@ set_selinux_context (char *filename,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (is_selinux_enabled ()) {
|
if (is_selinux_enabled ()) {
|
||||||
char *val_s;
|
if (setfilecon_raw (filename, val) < 0)
|
||||||
|
|
||||||
val_s = g_strdup (val);
|
|
||||||
|
|
||||||
if (setfilecon_raw (filename, val_s) < 0)
|
|
||||||
{
|
{
|
||||||
int errsv = errno;
|
int errsv = errno;
|
||||||
|
|
||||||
@@ -2729,7 +2725,6 @@ set_selinux_context (char *filename,
|
|||||||
g_strerror (errsv));
|
g_strerror (errsv));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
g_free (val_s);
|
|
||||||
} else {
|
} else {
|
||||||
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
|
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
|
||||||
_("SELinux is not enabled on this system"));
|
_("SELinux is not enabled on this system"));
|
||||||
|
Reference in New Issue
Block a user