]> SALOME platform Git repositories - modules/yacs.git/commitdiff
Salome HOME
Fix small memory leak in test
authorRenaud Barate <renaud.barate@edf.fr>
Wed, 9 Jul 2014 14:33:42 +0000 (16:33 +0200)
committerRenaud Barate <renaud.barate@edf.fr>
Wed, 9 Jul 2014 14:33:42 +0000 (16:33 +0200)
src/runtime/Test/TestComponent.cxx

index 4e5ef9ac3f0b7812362a1174a69a3af8c2001e97..1517d4be7f223b9d91fc2ddc21fc736268bf75ca 100644 (file)
@@ -58,11 +58,13 @@ extern "C" void __run(void *vObj, const char *service, int nIn, int nOut,
        obj->info.message = "";
        obj->info.code = 0;
        
+        Out[0] = NULL;
        if (std::strncmp(service, "f", 1) == 0) 
        {
                double _arg0 = In[0]->getDoubleValue();
                double _res = obj->f(_arg0);
-               Out[0] = YACS::ENGINE::AtomAny::New(_res);
+               if (obj->info.code == 0)
+                 Out[0] = YACS::ENGINE::AtomAny::New(_res);
        }
        else
        {
@@ -70,7 +72,6 @@ extern "C" void __run(void *vObj, const char *service, int nIn, int nOut,
                obj->info.message = "service ";
                obj->info.message += service;
                obj->info.message += " doesn't exist in TestComponent";
-               Out[0] = NULL;
        }
        *r = obj->info;
 }