fixing memory leaks during XML parsing
authorMiloš Mulač <mulac@civ.zcu.cz>
Thu, 22 Nov 2007 16:19:02 +0000 (16:19 +0000)
committerMiloš Mulač <mulac@civ.zcu.cz>
Thu, 22 Nov 2007 16:19:02 +0000 (16:19 +0000)
org.glite.lb.server/src/lb_xml_parse.c.T

index 5e42491..409709a 100644 (file)
@@ -556,6 +556,7 @@ static void endJobQueryRec(void *data, const char *el UNUSED_VAR)
                                break;
                }
        }
+       if (XMLCtx->char_buf) free(XMLCtx->char_buf);
         XMLCtx->char_buf = NULL;
         XMLCtx->char_buf_len = 0;
        XMLCtx->level--;
@@ -584,6 +585,7 @@ static void endQueryJobsRequest(void *data, const char *el UNUSED_VAR)
                                &XMLCtx->job_conditions);
                }
        }
+       if (XMLCtx->char_buf) free(XMLCtx->char_buf);
         XMLCtx->char_buf = NULL;
         XMLCtx->char_buf_len = 0;
        XMLCtx->level--;
@@ -731,6 +733,7 @@ static void endQueryEventsRequest(void *data, const char *el UNUSED_VAR)
                        }
                } 
        
+               if (XMLCtx->char_buf) free(XMLCtx->char_buf);
                XMLCtx->char_buf = NULL;
                XMLCtx->char_buf_len = 0;
        }
@@ -773,6 +776,7 @@ static void endPurgeRequest(void *data, const char *el UNUSED_VAR)
                }
        }
 
+       if (XMLCtx->char_buf) free(XMLCtx->char_buf);
        XMLCtx->char_buf = NULL;
         XMLCtx->char_buf_len = 0;
        XMLCtx->level--;
@@ -801,6 +805,7 @@ static void endDumpRequest(void *data, const char *el UNUSED_VAR)
                free(s);
        }
 
+       if (XMLCtx->char_buf) free(XMLCtx->char_buf);
        XMLCtx->char_buf = NULL;
         XMLCtx->char_buf_len = 0;
        XMLCtx->level--;
@@ -817,6 +822,7 @@ static void endLoadRequest(void *data, const char *el UNUSED_VAR)
                        XMLCtx->loadRequestGlobal.server_file = edg_wll_from_string_to_string(XMLCtx);
        }
 
+       if (XMLCtx->char_buf) free(XMLCtx->char_buf);
        XMLCtx->char_buf = NULL;
         XMLCtx->char_buf_len = 0;
        XMLCtx->level--;
@@ -852,6 +858,7 @@ static void endNotifRequest(void *data, const char *el UNUSED_VAR)
                }
        }
 
+       if (XMLCtx->char_buf) free(XMLCtx->char_buf);
        XMLCtx->char_buf = NULL;
         XMLCtx->char_buf_len = 0;
        XMLCtx->level--;
@@ -872,6 +879,7 @@ static void endQuerySequenceCodeRequest(void *data, const char *el UNUSED_VAR)
                }
        }
 
+       if (XMLCtx->char_buf) free(XMLCtx->char_buf);
        XMLCtx->char_buf = NULL;
         XMLCtx->char_buf_len = 0;
        XMLCtx->level--;
@@ -907,6 +915,7 @@ static void endStatsRequest(void *data, const char *el UNUSED_VAR)
                }
        }
 
+       if (XMLCtx->char_buf) free(XMLCtx->char_buf);
        XMLCtx->char_buf = NULL;
         XMLCtx->char_buf_len = 0;
        XMLCtx->level--;