Mercurial > pidgin.yaz
changeset 11390:869cef00a947
[gaim-migrate @ 13618]
make this a little safer
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Wed, 31 Aug 2005 18:37:10 +0000 |
parents | 098cfd8152bc |
children | d3755a7ddd82 |
files | src/xmlnode.c |
diffstat | 1 files changed, 6 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/xmlnode.c Wed Aug 31 18:28:31 2005 +0000 +++ b/src/xmlnode.c Wed Aug 31 18:37:10 2005 +0000 @@ -405,11 +405,15 @@ xmlnode * xmlnode_from_str(const char *str, gssize size) { - struct _xmlnode_parser_data *xpd = g_new0(struct _xmlnode_parser_data, 1); + struct _xmlnode_parser_data *xpd; xmlnode *ret; GMarkupParseContext *context; - gsize real_size = size == -1 ? strlen(str) : size; + gsize real_size; + g_return_val_if_fail(str != NULL, NULL); + + real_size = size == -1 ? strlen(str) : size; + xpd = g_new0(struct _xmlnode_parser_data, 1); context = g_markup_parse_context_new(&xmlnode_parser, 0, xpd, NULL); if(!g_markup_parse_context_parse(context, str, real_size, NULL)) {