[PATCH] fix file descriptor leak in stf.c



Hi.

This small patch closes a leak in an error condition. It's
based on the code for gnumeric 1.0.X.

Thanks for all the work in gnumeric!

Index: stf.c
===================================================================
RCS file: /cvs/gnome/gnumeric/src/stf.c,v
retrieving revision 1.37.2.4
diff -u -r1.37.2.4 stf.c
--- stf.c       2 Jun 2002 00:08:32 -0000       1.37.2.4
+++ stf.c       3 Jun 2002 21:37:26 -0000
@@ -90,6 +90,7 @@
         */
        data = calloc (1, sbuf.st_size + 1);
        if (!data)
+               close (fd);
                return NULL;
 
        /*
-- 
They that can give up essential liberty to obtain a little temporary
safety deserve neither liberty nor safety.
 -- Benjamin Franklin, Historical Review of Pennsylvania, 1759



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