]> git.ipfire.org Git - thirdparty/HylaFAX.git/commitdiff
Make faxq squeaky clean with valgrind --tool=memcheck
authorAidan Van Dyk <aidan@ifax.com>
Fri, 4 May 2007 17:12:51 +0000 (17:12 +0000)
committerAidan Van Dyk <aidan@ifax.com>
Fri, 4 May 2007 17:12:51 +0000 (17:12 +0000)
faxd/DestInfo.c++
faxd/Modem.c++
faxd/Modem.h
faxd/faxQueueApp.c++
util/Str.c++

index ee395fa3f0545398d993301dfc882b03dd5120e1..c87f989c6e1273bab1937e17ca07455729be7275 100644 (file)
@@ -45,7 +45,11 @@ DestInfo::DestInfo(const DestInfo& other)
     running = other.running;
 }
 
-DestInfo::~DestInfo() {}
+DestInfo::~DestInfo() 
+{
+    if (isOnList())
+       remove();
+}
 
 FaxMachineInfo&
 DestInfo::getInfo(const fxStr& number)
index 7ced6cdaf40217e9b86a07522fde70f6d9cf828f..f3b4039c6108d1cb5561131bc921c71ac2f2a685 100644 (file)
@@ -500,3 +500,19 @@ Modem::encode(fxStackBuffer& buf) const
     buf.put((const char*) &ec, sizeof (u_int));
     buf.put((const char*) &priority, sizeof (u_short));
 }
+
+
+void
+Modem::CLEANUP (void)
+{
+    ModemGroup::reset();
+    QLink* ql = list.next; 
+    while (ql != &list)
+    {
+       Modem* m = (Modem*)ql;
+       ql = ql->next;
+
+       delete m;
+    }
+
+}
index c9e9fb8cd4c781812777e0d434e9e82094173dbd..14039cc5f12553540402ea9ef19e89596439e6f0 100644 (file)
@@ -105,6 +105,8 @@ public:
     Modem(const fxStr& devid);
     virtual ~Modem();
 
+    static void CLEANUP (void);
+
     static Modem& getModemByID(const fxStr& id);
     static Modem* modemExists(const fxStr& id);
     static Modem* findModem(const Job& job);
index beae3e8626bd6871e82a8c55ea2f5b9bff91fc2e..e54bc3c705787f7f4102b7d3efbcd62746928e85 100644 (file)
@@ -3619,5 +3619,9 @@ main(int argc, char** argv)
     app->close();
     delete app;
 
+
+    Modem::CLEANUP();
+    delete &Dispatcher::instance();
+    
     return 0;
 }
index a6a472ed16dfd487f049ed2612a227dc47062d1c..4c8c31963c5c2165ea7b45da9bcebe3afbb94f7a 100644 (file)
@@ -407,6 +407,8 @@ void fxStr::operator=(const fxTempStr& s)
 
 void fxStr::operator=(const fxStr& s)
 {
+    if (data == s.data && slength == s.slength)
+       return;
     resizeInternal(s.slength-1);
     memcpy(data,s.data,s.slength);
     slength = s.slength;