gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r12533 - Extractor/src/main


From: gnunet
Subject: [GNUnet-SVN] r12533 - Extractor/src/main
Date: Sat, 14 Aug 2010 22:14:54 +0200

Author: grothoff
Date: 2010-08-14 22:14:54 +0200 (Sat, 14 Aug 2010)
New Revision: 12533

Modified:
   Extractor/src/main/extractor.c
Log:
fix leak on error

Modified: Extractor/src/main/extractor.c
===================================================================
--- Extractor/src/main/extractor.c      2010-08-14 20:09:56 UTC (rev 12532)
+++ Extractor/src/main/extractor.c      2010-08-14 20:14:54 UTC (rev 12533)
@@ -1179,6 +1179,7 @@
   struct IpcHeader hdr;
   size_t size;
   int want_tail;
+  int do_break;
 #ifdef WINDOWS
   HANDLE map;
 #endif
@@ -1250,7 +1251,7 @@
        {
          fn = hfn;     
        }
-
+      do_break = 0;
 #ifndef WINDOWS
       if ( (-1 != (shmid = shm_open (fn, O_RDONLY, 0))) &&
           (SIZE_MAX != (size = lseek (shmid, 0, SEEK_END))) &&
@@ -1262,15 +1263,14 @@
       if (ptr != NULL)
 #endif
        {
-         if ( (plugin->extractMethod != NULL) &&
-              (0 != plugin->extractMethod (ptr,
-                                           size,
-                                           &transmit_reply,
-                                           &out,
-                                           plugin->plugin_options)) )
-           break;          
-         if (0 != write_all (out, &hdr, sizeof(hdr)))
-           break;
+         if ( ( (plugin->extractMethod != NULL) &&
+                (0 != plugin->extractMethod (ptr,
+                                             size,
+                                             &transmit_reply,
+                                             &out,
+                                             plugin->plugin_options)) ) ||
+              (0 != write_all (out, &hdr, sizeof(hdr))) )
+           do_break = 1;
        }
 #ifndef WINDOWS
       if ( (ptr != NULL) &&
@@ -1284,6 +1284,8 @@
       if (map != NULL)
         CloseHandle (map);
 #endif
+      if (do_break)
+       break;
       if ( (plugin->specials != NULL) &&
           (NULL != strstr (plugin->specials,
                            "force-kill")) )




reply via email to

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