LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File enscript-1.6.4-fdleak.patch of Package enscript (Project openSUSE:11.4)

| BNC#524532
| Description From  David Binderman   2009-07-23 03:13:49 MDT   (-) [reply]     Private
| 
| I just had a look at factory package enscript-1.6.4-155.9
| 
| For source code file enscript-1.6.4/src/util.c,
| around line 110 is the source code for the
| function read_config.
| 
| I notice the following code
| 
|   fp = fopen (buffer_ptr (&fname), "r");
| 
| but no matching call to fclose.  This looks like a resource leak to me.
| 
| Suggest code rework. Maybe it would be enough to add
| 
|         fclose( fp);
| 
| near the end of the function.
| 
--- src/util.c
+++ src/util.c	2009-07-23 12:11:49.577901680 +0200
@@ -456,7 +456,7 @@ read_config (char *path, char *file)
       else
 	CFG_FATAL ((stderr, _("illegal option: %s"), token));
     }
-  return 1;
+  return (fclose (fp) == 0);
 }