Hi,
noticed this while reading some older emails from freeipa-devel. I
didn't test the patch, since it is really trivial.

Martin
>From 2e31847c8b4082e0ac95254867332cb3cbdda706 Mon Sep 17 00:00:00 2001
From: Martin Nagy <mn...@redhat.com>
Date: Tue, 16 Feb 2010 15:13:25 +0100
Subject: [PATCH] Fix a crash and memory leak in get_config_entry()

---
 ipa-client/config.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/ipa-client/config.c b/ipa-client/config.c
index f590d10..c32946e 100644
--- a/ipa-client/config.c
+++ b/ipa-client/config.c
@@ -91,7 +91,7 @@ get_config_entry(char * in_data, const char *section, const char *key)
     if (NULL == in_data)
         return NULL;
     else
-        strdup(in_data);
+        data = strdup(in_data);
 
     for (line = strtok_r(data, "\n", &ptr); line != NULL;
          line = strtok_r(NULL, "\n", &ptr)) {
@@ -156,5 +156,6 @@ get_config_entry(char * in_data, const char *section, const char *key)
             }
         }
     }
+    free(data);
     return NULL;
 }
-- 
1.6.2.5

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to