From 0a8c53575cc78117e96043c6b49587bc2f91361a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fatih=20A=C5=9F=C4=B1c=C4=B1?= Date: Fri, 28 Jun 2013 15:24:57 +0300 Subject: [PATCH] snmp: Fix a memory leak Check the value of vbi->ident before replacing it with vbo->ident. --- src/core/snmp/msg_in.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/core/snmp/msg_in.c b/src/core/snmp/msg_in.c index 662deec9..3a64909d 100644 --- a/src/core/snmp/msg_in.c +++ b/src/core/snmp/msg_in.c @@ -110,6 +110,11 @@ snmp_error_response(struct snmp_msg_pstat *msg_ps, u8_t error) struct snmp_varbind *vbi = msg_ps->invb.head; struct snmp_varbind *vbo = msg_ps->outvb.head; for (v=0; vvb_idx; v++) { + if (vbi->ident != NULL ) + { + memp_free(MEMP_SNMP_VALUE, vbi->ident); + } + vbi->ident_len = vbo->ident_len; vbo->ident_len = 0; vbi->ident = vbo->ident;