summaryrefslogtreecommitdiff
path: root/example/gjobread.c
diff options
context:
space:
mode:
Diffstat (limited to 'example/gjobread.c')
-rw-r--r--example/gjobread.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/example/gjobread.c b/example/gjobread.c
index b192bf4..d3f6d57 100644
--- a/example/gjobread.c
+++ b/example/gjobread.c
@@ -237,12 +237,14 @@ parseGjobFile(char *filename) {
*/
/* First level we expect just Jobs */
cur = cur->xmlChildrenNode;
- while ( cur && xmlIsBlankNode ( cur ) )
- {
+ while ( cur && xmlIsBlankNode ( cur ) ) {
cur = cur -> next;
- }
- if ( cur == 0 )
- return ( NULL );
+ }
+ if ( cur == 0 ) {
+ xmlFreeDoc(doc);
+ free(ret);
+ return ( NULL );
+ }
if ((xmlStrcmp(cur->name, (const xmlChar *) "Jobs")) || (cur->ns != ns)) {
fprintf(stderr,"document of the wrong type, was '%s', Jobs expected",
cur->name);