mirror of https://gitee.com/openkylin/libvirt.git
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;
|
||||
}
|
||||
|
||||
if (STREQ(*state, ""))
|
||||
if (STREQ_NULLABLE(*state, ""))
|
||||
VIR_FREE(*state);
|
||||
}
|
||||
|
||||
|
@ -871,7 +871,7 @@ static int virLockManagerSanlockInquire(virLockManagerPtr lock,
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (STREQ(*state, ""))
|
||||
if (STREQ_NULLABLE(*state, ""))
|
||||
VIR_FREE(*state);
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue