From e8f49f1b953662536d56445077b2b04b3ba53586 Mon Sep 17 00:00:00 2001 From: goldsimon Date: Wed, 3 Sep 2014 08:10:07 +0200 Subject: [PATCH] update CHANGELOG and fix coding style (fixed bug #39355 SNMP Memory Leak in case of error) --- CHANGELOG | 3 +++ src/core/snmp/msg_in.c | 5 ++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 14c6cbe0..133723de 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -117,6 +117,9 @@ HISTORY ++ Bugfixes: + 2014-09-03: Simon Goldschmidt + * msg_in.c: fixed bug #39355 SNMP Memory Leak in case of error + 2014-09-02: Simon Goldschmidt * err.h/.c, sockets.c, api_msg.c: fixed bug #43110 call getpeername() before listen() will cause a error diff --git a/src/core/snmp/msg_in.c b/src/core/snmp/msg_in.c index 3a64909d..db52da48 100644 --- a/src/core/snmp/msg_in.c +++ b/src/core/snmp/msg_in.c @@ -110,11 +110,10 @@ 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 ) - { + if (vbi->ident != NULL) { + /* free previously allocated value before overwriting the pointer */ memp_free(MEMP_SNMP_VALUE, vbi->ident); } - vbi->ident_len = vbo->ident_len; vbo->ident_len = 0; vbi->ident = vbo->ident;