]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
network_conf: Don't free uninitialized pointers while parsing DNS SRV
authorPeter Krempa <pkrempa@redhat.com>
Thu, 28 Jun 2012 21:42:50 +0000 (23:42 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 28 Jun 2012 21:42:50 +0000 (23:42 +0200)
If the user specified invalid protocol type in a network's SRV record
the error path ended up in freeing uninitialized pointers causing a
daemon crash.

*network_conf.c: virNetworkDNSSrvDefParseXML(): initialize local
                                                variables

src/conf/network_conf.c

index 60cd888a4ecb49f03f8eb19d0f52a5913dca4df8..515bc36edc1618b7cbea64ef60af6e6fa27fddec 100644 (file)
@@ -574,10 +574,10 @@ virNetworkDNSSrvDefParseXML(virNetworkDNSDefPtr def,
                             xmlNodePtr cur,
                             xmlXPathContextPtr ctxt)
 {
-    char *domain;
-    char *service;
-    char *protocol;
-    char *target;
+    char *domain = NULL;
+    char *service = NULL;
+    char *protocol = NULL;
+    char *target = NULL;
     int port;
     int priority;
     int weight;