[xmlsec] xmlSecPtrListEnsureSize failing
Aleksey Sanin
aleksey at aleksey.com
Thu Jan 22 10:57:19 PST 2004
Yes, I also have found it and send a separate request to xml mailing
list :) I just wonder why everyone else (including myself) does not
have this problem?
Actually there is another place that uses xmlRealloc() function.
The patch bellow fixes both.
Thanks for reporting the problem!
Aleksey
Index: buffer.c
===================================================================
RCS file: /cvs/gnome/xmlsec/src/buffer.c,v
retrieving revision 1.11
diff -u -r1.11 buffer.c
--- buffer.c 26 Sep 2003 00:58:10 -0000 1.11
+++ buffer.c 22 Jan 2004 18:53:30 -0000
@@ -302,7 +302,12 @@
newSize = gInitialSize;
}
- newData = (xmlSecByte*)xmlRealloc(buf->data, newSize);
+
+ if(buf->data != NULL) {
+ newData = (xmlSecByte*)xmlRealloc(buf->data, newSize);
+ } else {
+ newData = (xmlSecByte*)xmlMalloc(newSize);
+ }
if(newData == NULL) {
xmlSecError(XMLSEC_ERRORS_HERE,
NULL,
Index: list.c
===================================================================
RCS file: /cvs/gnome/xmlsec/src/list.c,v
retrieving revision 1.20
diff -u -r1.20 list.c
--- list.c 21 Jul 2003 03:12:47 -0000 1.20
+++ list.c 22 Jan 2004 18:53:30 -0000
@@ -442,7 +442,11 @@
newSize = gInitialSize;
}
- newData = (xmlSecPtr*)xmlRealloc(list->data, sizeof(xmlSecPtr) * newSize);
cvs diff: Diffing gnutls
+ if(list->data != NULL) {
+ newData = (xmlSecPtr*)xmlRealloc(list->data, sizeof(xmlSecPtr) * newSize
);
+ } else {
+ newData = (xmlSecPtr*)xmlMalloc(sizeof(xmlSecPtr) * newSize);
+ }
if(newData == NULL) {
xmlSecError(XMLSEC_ERRORS_HERE,
xmlSecErrorsSafeString(xmlSecPtrListGetName(list)),
More information about the xmlsec
mailing list