Fix crash in record conv rule select YAZ-812
[yaz-moved-to-github.git] / src / record_conv.c
index 1595faf..2fbe986 100644 (file)
@@ -385,12 +385,10 @@ static int convert_select(void *vinfo, WRBUF record, WRBUF wr_error)
                     for (i = 0; i < nodes->nodeNr; i++)
                     {
                         xmlNode *ptr = nodes->nodeTab[i];
-                        fprintf(stderr, "xpath result %d type=%d\n", i,
-                            ptr->type);
                         if (ptr->type == XML_ELEMENT_NODE)
                             ptr = ptr->children;
-                        if (ptr->type == XML_TEXT_NODE)
-                            for (; ptr; ptr = ptr->next)
+                        for (; ptr; ptr = ptr->next)
+                            if (ptr->type == XML_TEXT_NODE)
                                 wrbuf_puts(record, (const char *) ptr->content);
                     }
                 }
@@ -403,8 +401,12 @@ static int convert_select(void *vinfo, WRBUF record, WRBUF wr_error)
     return ret;
 }
 
-static void destroy_select(void *info)
+static void destroy_select(void *vinfo)
 {
+    struct select_info *info = vinfo;
+
+    if (info)
+        nmem_destroy(info->nmem);
 }