[Live-devel] memory ownership in UserAuthenticationDatabase liveMedia/RTSPServer.cpp

PROMONET Michel michel.promonet at thalesgroup.com
Mon Dec 5 05:54:25 PST 2011


                Hi,

In UserAuthenticationDatabase::addUserRecord, the value inserted in the map is allocated through strDup(password).
As the class allocate the memory, I think the class own this memory, then the destructor should free it.

Is it possible to insert in the destructor something like :
UserAuthenticationDatabase::~UserAuthenticationDatabase() {
   delete[] fRealm;
+  char* password = NULL;
+  while ((password = (char*)fTable->RemoveNext()) != NULL) {
+    delete[] password;
+  }
   delete fTable;
 }

It's possible through the removeUserRecord to free it, but this way need to keep in an other container the key to free.
What's your feeling about this ?

Regards,

                Michel.

[@@THALES GROUP RESTRICTED@@]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20111205/411d5e3d/attachment-0001.html>


More information about the live-devel mailing list