pam: Avoid segfault on login without devices

Avoid crashing if paths_array is NULL.

https://bugs.freedesktop.org/show_bug.cgi?id=49904
This commit is contained in:
Didier Raboud
2012-05-14 15:29:30 +02:00
committed by Bastien Nocera
parent 4c120e487b
commit 73edad087f

View File

@ -182,7 +182,9 @@ static DBusGProxy *open_device(pam_handle_t *pamh, DBusGConnection *connection,
return NULL;
}
if (paths_array == NULL) {
if (paths_array == NULL || paths_array->len == 0) {
if (paths_array != NULL)
g_ptr_array_free (paths_array, TRUE);
D(pamh, "No devices found\n");
return NULL;
}