myserver-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[myserver-commit] [SCM] GNU MyServer branch, master, updated. v0.9.2-388


From: Giuseppe Scrivano
Subject: [myserver-commit] [SCM] GNU MyServer branch, master, updated. v0.9.2-388-g99eb202
Date: Mon, 30 Aug 2010 00:41:14 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU MyServer".

The branch, master has been updated
       via  99eb202fbb6442f0d8a3cebc1de824b76ec1d8c6 (commit)
      from  a2f8be3feb4375098298d9d00dded7fa2895ba29 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------


commit 99eb202fbb6442f0d8a3cebc1de824b76ec1d8c6
Author: Giuseppe Scrivano <address@hidden>
Date:   Mon Aug 30 02:33:47 2010 +0200

    Fix some possible memory leaks.

diff --git a/myserver/src/base/files_cache/cached_file_factory.cpp 
b/myserver/src/base/files_cache/cached_file_factory.cpp
index 62bc658..e59dc0f 100644
--- a/myserver/src/base/files_cache/cached_file_factory.cpp
+++ b/myserver/src/base/files_cache/cached_file_factory.cpp
@@ -180,11 +180,15 @@ File* CachedFileFactory::open (const char* filename, int 
flags)
 
               File *file = new File ();
               flags = flags & File::NO_FOLLOW_SYMLINK;
-              if (file->openFile (filename, File::OPEN_IF_EXISTS | flags
-                                  | File::READ))
+              try
+                {
+                  file->openFile (filename, File::OPEN_IF_EXISTS | flags
+                                  | File::READ);
+                }
+              catch (...)
                 {
                   delete file;
-                  return NULL;
+                  throw;
                 }
               return file;
             }
@@ -195,16 +199,20 @@ File* CachedFileFactory::open (const char* filename, int 
flags)
           u_long fileSize;
           File *file = new File ();
           flags = flags & File::NO_FOLLOW_SYMLINK;
-          if (file->openFile (filename, File::OPEN_IF_EXISTS | flags
-                              | File::READ))
+          try
+            {
+              file->openFile (filename, File::OPEN_IF_EXISTS | flags
+                              | File::READ);
+            }
+          catch (...)
             {
               delete file;
-              return NULL;
+              throw;
             }
 
           fileSize = file->getFileSize ();
           if (minSize && fileSize < minSize
-               || maxSize && fileSize > maxSize
+              || maxSize && fileSize > maxSize
               || fileSize > size - usedSize)
             return file;
           else
diff --git a/myserver/src/conf/mime/xml_mime_handler.cpp 
b/myserver/src/conf/mime/xml_mime_handler.cpp
index 0921067..009226c 100644
--- a/myserver/src/conf/mime/xml_mime_handler.cpp
+++ b/myserver/src/conf/mime/xml_mime_handler.cpp
@@ -133,6 +133,7 @@ MimeRecord *XmlMimeHandler::readRecord (xmlNodePtr node)
 
                   if (r->compile ((const char*)attrs->children->content, 0))
                     {
+                      delete rc;
                       delete r;
                       return NULL;
                     }
diff --git a/myserver/src/protocol/gopher/gopher_content.cpp 
b/myserver/src/protocol/gopher/gopher_content.cpp
index ac96e4c..0227035 100644
--- a/myserver/src/protocol/gopher/gopher_content.cpp
+++ b/myserver/src/protocol/gopher/gopher_content.cpp
@@ -348,13 +348,21 @@ void GopherData::toProtocol (Socket *s)
 GopherFileContent::GopherFileContent (string fnome)
 {
   sfile = new File ();
-  sfile->openFile (fnome.c_str (), File::READ);
+  try
+    {
+      sfile->openFile (fnome.c_str (), File::READ);
+    }
+  catch (...)
+    {
+      delete sfile;
+      throw;
+    }
+
   buf.setLength (4096);
 }
 
 GopherFileContent::~GopherFileContent ()
 {
-  sfile->close ();
   delete sfile;
 }
 

-----------------------------------------------------------------------

Summary of changes:
 .../src/base/files_cache/cached_file_factory.cpp   |   22 +++++++++++++------
 myserver/src/conf/mime/xml_mime_handler.cpp        |    1 +
 myserver/src/protocol/gopher/gopher_content.cpp    |   12 +++++++++-
 3 files changed, 26 insertions(+), 9 deletions(-)


hooks/post-receive
-- 
GNU MyServer



reply via email to

[Prev in Thread] Current Thread [Next in Thread]