From: Peter Krempa Date: Wed, 7 Mar 2012 14:04:33 +0000 (+0100) Subject: sanlock: Use STREQ_NULLABLE instead of STREQ on strings that may be null X-Git-Tag: v0.9.11-rc1~107 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=96b41f639dd14acf389342f3166274204546319a;p=thirdparty%2Flibvirt.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. --- diff --git a/src/locking/lock_driver_sanlock.c b/src/locking/lock_driver_sanlock.c index 295e45d98b..d344d6ae46 100644 --- a/src/locking/lock_driver_sanlock.c +++ b/src/locking/lock_driver_sanlock.c @@ -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;