[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH 04/10] parallels: Need to handle virJSONValueObjectGetString error

On 01/17/13 20:17, John Ferlan wrote:
  src/parallels/parallels_driver.c | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c
index ea193af..1cf66ea 100644
--- a/src/parallels/parallels_driver.c
+++ b/src/parallels/parallels_driver.c
@@ -514,7 +514,10 @@ parallelsGetNetInfo(virDomainNetDefPtr net,

      if (virJSONValueObjectHasKey(value, "state")) {
-        tmp = virJSONValueObjectGetString(value, "state");

Hm calling this without checking should be safe as the virJSONValueObjectHasKey basically guarantees successful return of a value in virJSONValueObjectGetString.

+        if (!(tmp = virJSONValueObjectGetString(value, "state"))) {
+            parallelsParseError();
+            goto error;
+        }
          if STREQ(tmp, "disconnected")
              net->linkstate = VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DOWN;

I don't mind doing the change, but I think this is a false positive.

I give ACK to this patch, but it shouldn't be a problem to go without it.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]