projects
/
yaz-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix idmetaversion strips n SA-743
[yaz-moved-to-github.git]
/
src
/
xml_match.c
diff --git
a/src/xml_match.c
b/src/xml_match.c
index
dd804db
..
7dddb6f
100644
(file)
--- a/
src/xml_match.c
+++ b/
src/xml_match.c
@@
-1,5
+1,5
@@
/* This file is part of the YAZ toolkit.
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2013 Index Data
+ * Copyright (C) Index Data
* See the file LICENSE for details.
*/
/**
* See the file LICENSE for details.
*/
/**
@@
-16,7
+16,8
@@
int yaz_match_xsd_element(xmlNodePtr ptr, const char *elem)
{
int yaz_match_xsd_element(xmlNodePtr ptr, const char *elem)
{
- if (ptr->type == XML_ELEMENT_NODE && !xmlStrcmp(ptr->name, BAD_CAST elem))
+ if (ptr && ptr->type == XML_ELEMENT_NODE &&
+ !xmlStrcmp(ptr->name, BAD_CAST elem))
{
return 1;
}
{
return 1;
}
@@
-107,10
+108,7
@@
int yaz_match_xsd_XML_n2(xmlNodePtr ptr, const char *elem, ODR o,
xmlBufferAddHead(buf, (const xmlChar *) "<yaz_record>", -1);
xmlBufferAdd(buf, (const xmlChar *) "</yaz_record>", -1);
}
xmlBufferAddHead(buf, (const xmlChar *) "<yaz_record>", -1);
xmlBufferAdd(buf, (const xmlChar *) "</yaz_record>", -1);
}
- *val = (char *) odr_malloc(o, buf->use + 1);
- memcpy(*val, buf->content, buf->use);
- (*val)[buf->use] = '\0';
-
+ *val = odr_strdupn(o, (const char *) buf->content, buf->use);
if (len)
*len = buf->use;
if (len)
*len = buf->use;