freecwmp
[Top] [All Lists]

Patch for two memleaks in connection request scenario

To: "freecwmp@linux-mips.org" <freecwmp@linux-mips.org>
Subject: Patch for two memleaks in connection request scenario
From: Rajsek Miroslav <miroslav.rajsek@innbox.net>
Date: Fri, 16 Nov 2012 13:56:10 +0100
Accept-language: sl-SI
Acceptlanguage: sl-SI
Original-recipient: rfc822;freecwmp@linux-mips.org
Sender: freecwmp-bounce@linux-mips.org
Thread-index: AQHNw/i5QCts22xAjEK7GiCjXuYXIw==
Thread-topic: Patch for two memleaks in connection request scenario
Hi  Luka, hi everybody

My name is Miroslav Rajsek, I am from Slovenia, working for a CPE manufacturer.
I am responsible for TR-069, so I am following freecwmp project more or less 
intensively for about two or three months. I am subscribed at #freecwmp IRC, my 
nickname is rajsek.
I am using Motive HDM and NetMania AcsLite TR-069 ACSs in my test environment, 
OpenACS from time to time. 

I am testing freecwmp-curl in development environment on my ubuntu desktop. I 
have also ported freecwmp-curl to one of our CPE under development, based on 
PowerPC and using openwrt. 
Today I was running freecwmp with valgrind on my ubuntu and noticed two small 
memory leaks in scenario when connection request was sent from ACS.  As far as 
fetching latest commits it seems to me a fix has not been provided yet. However 
it could be the thing is already known to you.

So I have a patch proposal below. Note that this is my very first patch. Please 
can you check it, I am glad if you find it useful. 

Regards,

Miroslav


---
 src/http.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/http.c b/src/http.c
index 8663598..6540eb4 100644
--- a/src/http.c
+++ b/src/http.c
@@ -107,7 +107,7 @@ http_client_exit(void)
        FREE(http_c.url);
 
 #ifdef HTTP_CURL
-       if (!http_c.header_list)
+       if (http_c.header_list)
                curl_slist_free_all(http_c.header_list);
        if (access(fc_cookies, W_OK) == 0)
                remove(fc_cookies);
@@ -401,6 +401,7 @@ http_end_child:
 
 done_child:
                        fclose(fp);
+                       free(uproc);
                        DDF("--- RECEIVED HTTP REQUEST ---\n");
                        exit(status);
                }
-- 
1.7.0.4




 

<Prev in Thread] Current Thread [Next in Thread>