]> xenbits.xensource.com Git - libvirt.git/commitdiff
conf: handle null pointer in virNetDevVlanFormat
authorLaine Stump <laine@laine.org>
Thu, 20 Feb 2014 11:59:55 +0000 (13:59 +0200)
committerLaine Stump <laine@laine.org>
Tue, 25 Feb 2014 13:56:12 +0000 (15:56 +0200)
Other *Format() functions (e.g. virNetDevBandwidthFormat()) return
with no action when called with a NULL *Def pointer. This makes
virNetDevVlanFormat() consistent with that behavior.

src/conf/netdev_vlan_conf.c

index f58b4b8fd732cf74151b8dffc2e1b6c9e7488da2..dbe203e8f9b9d23097ddfa810890a287570d1a87 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2009-2013 Red Hat, Inc.
+ * Copyright (C) 2009-2014 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -144,7 +144,7 @@ virNetDevVlanFormat(const virNetDevVlan *def, virBufferPtr buf)
 {
     size_t i;
 
-    if (def->nTags == 0)
+    if (!(def && def->nTags))
         return 0;
 
     if (!def->tag) {