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

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




+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


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