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:
Peter Krempa 2012-03-07 15:04:33 +01:00
parent 3bf5f0427a
commit 96b41f639d

View File

@ -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;