提交 96b41f63 编写于 作者: P Peter Krempa

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.
上级 3bf5f042
...@@ -828,7 +828,7 @@ static int virLockManagerSanlockRelease(virLockManagerPtr lock, ...@@ -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, ...@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册