Leak fixing hacks.
authorFrantišek Dvořák <valtri@civ.zcu.cz>
Thu, 23 Oct 2008 12:54:02 +0000 (12:54 +0000)
committerFrantišek Dvořák <valtri@civ.zcu.cz>
Thu, 23 Oct 2008 12:54:02 +0000 (12:54 +0000)
org.glite.lb.common/Makefile
org.glite.lb.common/src/events_parse.c.T
org.glite.lb.common/src/xml_parse.c.T
org.glite.lb.common/test/il_int_test.cpp
org.glite.lb.common/test/parse.cpp.T
org.glite.lb.common/test/test_main.cpp
org.glite.lb.types/types.T

index 02b02bb..d55c727 100644 (file)
@@ -174,7 +174,7 @@ mkreports:
 check.parse: test_parse
        ./test_parse ${REPORTS}/parse.xml
 
-test_parse: parse.o
+test_parse: parse.o test_main.cpp
        ${LINKXX} -o test_parse parse.o ${LTLIB} ${TEST_LIBS} ${EXT_LIBS}
 
 check.il: il_test
index b3a5788..e80aee4 100644 (file)
@@ -432,6 +432,8 @@ edg_wll_ErrorCode edg_wll_CompareEvents(
        const edg_wll_Event *e2         /* event 2 IN */
 )
 {
+       char *tmp1, *tmp2;
+       int tmp3;
        if (e1->any.type != e2->any.type) return edg_wll_SetError(context,EDG_WLL_ERROR_COMPARE_EVENTS,"Different event types");
 @@@{
        selectType $event '_common_';
index 5c47b2c..6a3dddc 100644 (file)
@@ -2870,13 +2870,15 @@ int edg_wll_NotifRequestToXML(
                int flags,
                 char **message)
 {
-       char *pomA=NULL, *pomB=NULL, *pomC=NULL, *cflags=NULL;
+       char *pomA=NULL, *pomB=NULL, *pomC=NULL, *cflags=NULL, *nid=NULL, *nop=NULL;
 
 
        pomA = strdup("");
-       edg_wll_add_string_to_XMLBody(&pomA, edg_wll_NotifIdUnparse(notifId), "notifId", NULL);
+       nid = edg_wll_NotifIdUnparse(notifId);
+       nop = edg_wll_NotifChangeOpToString(op);
+       edg_wll_add_string_to_XMLBody(&pomA, nid, "notifId", NULL);
        edg_wll_add_string_to_XMLBody(&pomA, address, "clientAddress", NULL);
-       edg_wll_add_string_to_XMLBody(&pomA, edg_wll_NotifChangeOpToString(op), "notifChangeOp", NULL);
+       edg_wll_add_string_to_XMLBody(&pomA, nop, "notifChangeOp", NULL);
        edg_wll_add_time_t_to_XMLBody(&pomA, validity, "requestedValidity", -1);
        if (conditions && conditions[0] && conditions[0][0].attr != EDG_WLL_QUERY_ATTR_UNDEF)
                edg_wll_JobQueryRecToXML(ctx, conditions, &pomB);
@@ -2891,6 +2893,8 @@ int edg_wll_NotifRequestToXML(
 
 
        free(cflags);
+       free(nid);
+       free(nop);
        free(pomA);
        free(pomB);
         *message = pomC;
index f547019..2ed6a83 100644 (file)
@@ -26,7 +26,7 @@ public:
 
        void testPutInt() {
                put_int(buffer, 17);
-               CPPUNIT_ASSERT(!strcmp(buffer, "17\n"));
+               CPPUNIT_ASSERT(!strncmp(buffer, "17\n", 3));
        }
 
        void testGetInt() {
index e5cd14a..d8c7e9b 100644 (file)
@@ -59,7 +59,7 @@ void EventParseTest::$l()
        e1->any.level = 7;
        e1->any.priority = 0;
        edg_wlc_JobIdParse("https://some.host:1234/x67qr549qc",&e1->any.jobId);
-       e1->any.seqcode = EDG_WLL_SEQ_BIGHELPER_INITIAL;
+       e1->any.seqcode = strdup(EDG_WLL_SEQ_BIGHELPER_INITIAL);
        e1->any.user = strdup("/O=Grid/CN=This User");
        e1->any.source = EDG_WLL_SOURCE_USER_INTERFACE;
        e1->any.src_instance = strdup("");
@@ -117,6 +117,11 @@ void EventParseTest::$l()
                edg_wll_Error(ctx,&et,&ed);
                CPPUNIT_ASSERT_MESSAGE(std::string("edg_wll_CompareEvents():") + et + " " + ed, 0);
        }
+
+       edg_wll_FreeEvent(e1); free(e1);
+       edg_wll_FreeEvent(e2); free(e2);
+       edg_wll_FreeContext(ctx);
+       free(line);
 }
 ';
 
index b2f6fdd..43ebc57 100644 (file)
@@ -8,6 +8,8 @@
 #include <cppunit/TestResult.h>
 #include <cppunit/TestResultCollector.h>
 
+#include <glite/lb/connpool.h>
+
 int main (int argc,const char *argv[])
 {
        CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
@@ -28,5 +30,7 @@ int main (int argc,const char *argv[])
        xout.write();
        tout.write();
 
+       edg_wll_poolFree();
+
        return result.wasSuccessful() ? 0 : 1 ;
 }
index fee3817..cc10e81 100644 (file)
                string=>'if ($b eq \'NULL\') { qq{(($a) == NULL)}; } 
                        else { qq{(($a) == NULL && ($b) == NULL) || (($a)&&($b)&& !strcmp($a,$b))}; } ',
                jobid=>'if ($b eq \'NULL\') { qq{(($a) == NULL) }; }
-                       else { qq{(($a) == NULL && ($b) == NULL) || (($a)&&($b)&& !strcmp(edg_wlc_JobIdUnparse($a),edg_wlc_JobIdUnparse($b)))}; }',
+                       else { qq{(($a) == NULL && ($b) == NULL) || (($a)&&($b)&& !(tmp1=glite_jobid_unparse($a),tmp2=glite_jobid_unparse($b),tmp3=strcmp(tmp1,tmp2),free(tmp1),free(tmp2),tmp3))}; }',
                notifid=>'if ($b eq \'NULL\') { qq{(($a) == NULL) }; }
-                       else { qq{(($a) == NULL && ($b) == NULL) || (($a)&&($b)&& !strcmp(edg_wll_NotifIdUnparse($a),edg_wll_NotifIdUnparse($b)))}; }',
+                       else { qq{(($a) == NULL && ($b) == NULL) || (($a)&&($b)&& !(tmp1=edg_wll_NotifIdUnparse($a),tmp2=edg_wll_NotifIdUnparse($b),tmp3=strcmp(tmp1,tmp2),free(tmp1),free(tmp2),tmp3))}; }',
                logsrc=>'"($a) == ($b)"',
                timeval=>'"($a).tv_sec == ($b).tv_sec && ($a).tv_usec == ($b).tv_usec"',
                cclassad=>'"($a == $b)"',