Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

memory leak #2

Open
GBert opened this issue Dec 18, 2015 · 0 comments
Open

memory leak #2

GBert opened this issue Dec 18, 2015 · 0 comments

Comments

@GBert
Copy link

GBert commented Dec 18, 2015

Hi Bjoern,

nice tiny snmp agent. I'm using it to monitor my EDL21 capable power meter.
Anyway, I saw a memory leak. 'decode_oid' allocates a string which is never freed.

Follwowing patch will fix it:

diff --git a/snmp.c b/snmp.c
index 92b2474..caf4d8b 100644
--- a/snmp.c
+++ b/snmp.c
@@ -648,6 +648,7 @@ void clr_varbind_list_rx(struct varbind_list_rx *varbind_list)
        unsigned int i;

        for(i=(varbind_list->varbind_idx);i>0;i--){
+               free(varbind_list->varbind_list[i-1]->oid)
                free(varbind_list->varbind_list[i-1]->value);
                free(varbind_list->varbind_list[i-1]);
        }

Regards

Gerd

PS:
My project: https://github.com/GBert/openwrt-misc/tree/master/sml-snmp-agent

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant