Skip to content

Commit

Permalink
Fix crash when mapping pids
Browse files Browse the repository at this point in the history
Calling g_mutex_locker_new() with NULL isn't valid.
  • Loading branch information
TingPing committed Feb 1, 2022
1 parent f29d6b1 commit bceb762
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/xdp-utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ struct _XdpAppInfo {
{
GKeyFile *keyfile;
/* pid namespace mapping */
GMutex *pidns_lock;
GMutex pidns_lock;
ino_t pidns_id;
} flatpak;
struct
Expand Down Expand Up @@ -1928,7 +1928,9 @@ xdg_app_info_ensure_pidns (XdpAppInfo *app_info,
ino_t ns;
int r;

guard = g_mutex_locker_new (app_info->u.flatpak.pidns_lock);
g_assert (app_info->kind == XDP_APP_INFO_KIND_FLATPAK);

guard = g_mutex_locker_new (&(app_info->u.flatpak.pidns_lock));

if (app_info->u.flatpak.pidns_id != 0)
return TRUE;
Expand Down

0 comments on commit bceb762

Please sign in to comment.