You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by pi...@apache.org on 2007/11/15 09:50:33 UTC

svn commit: r595240 - /webservices/axis2/trunk/c/axiom/src/attachments/data_handler.c

Author: pini
Date: Thu Nov 15 00:50:32 2007
New Revision: 595240

URL: http://svn.apache.org/viewvc?rev=595240&view=rev
Log:
Fixing jira issue 742 and 743

Modified:
    webservices/axis2/trunk/c/axiom/src/attachments/data_handler.c

Modified: webservices/axis2/trunk/c/axiom/src/attachments/data_handler.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/axiom/src/attachments/data_handler.c?rev=595240&r1=595239&r2=595240&view=diff
==============================================================================
--- webservices/axis2/trunk/c/axiom/src/attachments/data_handler.c (original)
+++ webservices/axis2/trunk/c/axiom/src/attachments/data_handler.c Thu Nov 15 00:50:32 2007
@@ -170,20 +170,22 @@
             return AXIS2_FAILURE;
         }
 
-        do
+        struct stat stat_p;
+        if (-1 == stat(data_handler->file_name, &stat_p))
         {
-            struct stat stat_p;
-            if (-1 == stat(data_handler->file_name, &stat_p))
-            {
-                return AXIS2_FAILURE;
-            }
-            else if (stat_p.st_size == 0)
-            {
-                *output_stream = NULL;
-                *output_stream_size = 0;
-                return AXIS2_SUCCESS;
-            }
+	    fclose(f);
+            return AXIS2_FAILURE;
+        }
+        else if (stat_p.st_size == 0)
+        {
+            fclose(f);
+            *output_stream = NULL;
+            *output_stream_size = 0;
+            return AXIS2_SUCCESS;
+        }
 
+        do
+        {
             read_stream_size = stat_p.st_size;
             read_stream = AXIS2_MALLOC(env->allocator,
                                        (read_stream_size) *
@@ -196,6 +198,7 @@
                 {
                     AXIS2_FREE(env->allocator, byte_stream);
                 }
+                fclose(f);
                 return AXIS2_FAILURE;
             }
             count = fread(read_stream, 1, read_stream_size, f);
@@ -211,6 +214,7 @@
                 {
                     AXIS2_FREE(env->allocator, read_stream);
                 }
+                fclose(f);
                 return AXIS2_FAILURE;
             }
 
@@ -237,6 +241,7 @@
                         {
                             AXIS2_FREE(env->allocator, temp_byte_stream);
                         }
+                        fclose(f);
                         return AXIS2_FAILURE;
                     }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org