[PATCH] Fix file leak in an example application.

Giuseppe Scrivano giuseppe at southpole.se
Wed Feb 15 11:21:02 CET 2012


Hello,

A one-line fix for an example application.

Cheers,
Giuseppe



>From de9425794cdefccf1d18aeebc17cde5a274f7e5e Mon Sep 17 00:00:00 2001
From: Giuseppe Scrivano <giuseppe at southpole.se>
Date: Wed, 15 Feb 2012 11:13:54 +0100
Subject: [PATCH] Fix file leak in an example application.

---
 doc/examples/ex-cert-select.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/doc/examples/ex-cert-select.c b/doc/examples/ex-cert-select.c
index d45e8e5..e99baf4 100644
--- a/doc/examples/ex-cert-select.c
+++ b/doc/examples/ex-cert-select.c
@@ -59,6 +59,8 @@ load_file (const char *file)
       || !(ptr = malloc ((size_t) filelen))
       || fread (ptr, 1, (size_t) filelen, f) < (size_t) filelen)
     {
+      if (f)
+        fclose (f);
       return loaded_file;
     }
 
-- 
1.7.7.6




More information about the Gnutls-devel mailing list