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 yaz_use_attribute_create (uninit memory)
[yaz-moved-to-github.git]
/
src
/
srwutil.c
diff --git
a/src/srwutil.c
b/src/srwutil.c
index
83665d4
..
493a7a3
100644
(file)
--- a/
src/srwutil.c
+++ b/
src/srwutil.c
@@
-45,7
+45,7
@@
Z_AttributeElement *yaz_string_element_create(ODR o, int type,
Z_AttributeElement *element = (Z_AttributeElement*)
odr_malloc(o, sizeof(*element));
element->attributeType = odr_intdup(o, type);
Z_AttributeElement *element = (Z_AttributeElement*)
odr_malloc(o, sizeof(*element));
element->attributeType = odr_intdup(o, type);
- element->attributeSet = odr_nullval();
+ element->attributeSet = 0;
element->which = Z_AttributeValue_complex;
element->value.complex = (Z_ComplexAttribute *)
odr_malloc(o, sizeof(Z_ComplexAttribute));
element->which = Z_AttributeValue_complex;
element->value.complex = (Z_ComplexAttribute *)
odr_malloc(o, sizeof(Z_ComplexAttribute));
@@
-65,12
+65,11
@@
Z_AttributeList *yaz_use_attribute_create(ODR o, const char *name)
{
Z_AttributeList *attributes = (Z_AttributeList *)
odr_malloc(o, sizeof(*attributes));
{
Z_AttributeList *attributes = (Z_AttributeList *)
odr_malloc(o, sizeof(*attributes));
- Z_AttributeElement **elements = (Z_AttributeElement**)
- odr_malloc(o, attributes->num_attributes * sizeof(*elements));
- elements[0] = yaz_string_element_create(o, 1, name);
attributes->num_attributes = 1;
attributes->num_attributes = 1;
- attributes->attributes = elements;
+ attributes->attributes = (Z_AttributeElement**)
+ odr_malloc(o, sizeof(*attributes->attributes));
+ attributes->attributes[0] = yaz_string_element_create(o, 1, name);
return attributes;
}
return attributes;
}