Re: [PATCH V6 1/3] Add a class for file descriptor sets

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

 




+int virFdSetParseXML(virFdSetPtr fdset, const char *xPath,
+                     xmlXPathContextPtr ctxt)
+{
+    xmlNodePtr *nodes = NULL;
+    int n, i;
+    char *key = NULL;
+    char *val = NULL;
+    unsigned int *fdsetnum = NULL;
+    int ret = 0;
+
+    virFdSetReset(fdset);
+
+    if ((n = virXPathNodeSet(xPath, ctxt, &nodes)) < 0) {
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       "%s", _("failed to parse qemu file descriptor sets"));
+        goto error;
+    }
+    if (n > 0) {
+        for (i = 0 ; i < n ; i++) {
+            key = virXMLPropString(nodes[i], "alias");
+            val = virXMLPropString(nodes[i], "fdset");
+            if (key && val) {
+                if (VIR_ALLOC(fdsetnum) < 0) {
+                    virReportOOMError();
+                    ret = -1;
+                    goto error;
+                }
+                if (virStrToLong_ui(val, NULL, 10, fdsetnum) < 0) {
+                    virReportError(VIR_ERR_INTERNAL_ERROR,
+                                   _("incorrect fdset '%s', expected positive"
+                                   "integer"), val);
+                    VIR_FREE(fdsetnum);
+                    ret = -1;
+                    goto error;
+                }
+
+                if (fdset->nextfdset <= *fdsetnum)
+                    fdset->nextfdset = *fdsetnum + 1;
+
+                if (virHashAddEntry(fdset->aliasToFdSet, key, fdsetnum) < 0) {
+                    virReportOOMError();
+                    VIR_FREE(fdset);

Is this supposed to be freeing fdsetnum?

--
Regards,
Corey Bryant

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]