mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-23 20:02:21 +00:00
sanlock: Use STREQ_NULLABLE instead of STREQ on strings that may be null
The function sanlock_inquire can return NULL in the state string if the message consists only of a header. The return value is arbitrary and sent by the server. We should proceed carefully while touching such pointers.
This commit is contained in:
parent
3bf5f0427a
commit
96b41f639d
@ -828,7 +828,7 @@ static int virLockManagerSanlockRelease(virLockManagerPtr lock,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (STREQ(*state, ""))
|
if (STREQ_NULLABLE(*state, ""))
|
||||||
VIR_FREE(*state);
|
VIR_FREE(*state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -871,7 +871,7 @@ static int virLockManagerSanlockInquire(virLockManagerPtr lock,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (STREQ(*state, ""))
|
if (STREQ_NULLABLE(*state, ""))
|
||||||
VIR_FREE(*state);
|
VIR_FREE(*state);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user