mirror of
https://gitlab.com/mishakmak/pam-fprint-grosshack.git
synced 2026-04-09 04:13:33 +02:00
device: Fix client_username memory leak
No need to duplicate that string until we pass it out. From https://bugs.launchpad.net/ubuntu/+source/fprintd/+bug/1745455/comments/7
This commit is contained in:
@ -469,7 +469,6 @@ _fprint_device_check_for_username (FprintDevice *rdev,
|
|||||||
char *sender;
|
char *sender;
|
||||||
unsigned long uid;
|
unsigned long uid;
|
||||||
struct passwd *user;
|
struct passwd *user;
|
||||||
char *client_username;
|
|
||||||
|
|
||||||
/* Get details about the current sender, and username/uid */
|
/* Get details about the current sender, and username/uid */
|
||||||
conn = dbus_g_connection_get_connection (fprintd_dbus_conn);
|
conn = dbus_g_connection_get_connection (fprintd_dbus_conn);
|
||||||
@ -490,17 +489,16 @@ _fprint_device_check_for_username (FprintDevice *rdev,
|
|||||||
"Failed to get information about user UID %lu", uid);
|
"Failed to get information about user UID %lu", uid);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
client_username = g_strdup (user->pw_name);
|
|
||||||
|
|
||||||
/* The current user is usually allowed to access their
|
/* The current user is usually allowed to access their
|
||||||
* own data, this should be followed by PolicyKit checks
|
* own data, this should be followed by PolicyKit checks
|
||||||
* anyway */
|
* anyway */
|
||||||
if (username == NULL || *username == '\0' || g_str_equal (username, client_username)) {
|
if (username == NULL || *username == '\0' || g_str_equal (username, user->pw_name)) {
|
||||||
if (ret_sender != NULL)
|
if (ret_sender != NULL)
|
||||||
*ret_sender = sender;
|
*ret_sender = sender;
|
||||||
else
|
else
|
||||||
g_free (sender);
|
g_free (sender);
|
||||||
return client_username;
|
return g_strdup (user->pw_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we're not allowed to set a different username,
|
/* If we're not allowed to set a different username,
|
||||||
|
|||||||
Reference in New Issue
Block a user