From 941c83734a0b06ca5c151864d87091947b8563b1 Mon Sep 17 00:00:00 2001 From: shawarma <> Date: Wed, 23 Mar 2005 21:55:00 +0000 Subject: [PATCH] Fixed a few memory freeing issues which were probably only significant on platforms with REALLY braindead malloc/free implementations --- mbuni/mmlib/mms_msg.c | 4 ++-- mbuni/mmlib/mms_util.c | 12 +++++++++++- mbuni/mmlib/mms_util.h | 2 ++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/mbuni/mmlib/mms_msg.c b/mbuni/mmlib/mms_msg.c index 9603dac..b6b563b 100644 --- a/mbuni/mmlib/mms_msg.c +++ b/mbuni/mmlib/mms_msg.c @@ -1053,8 +1053,8 @@ MmsMsg *mms_frombinary(Octstr *msg, Octstr *from) if ((res = decode_msgbody(p, &_m)) < 0) { MmsMsg *msg = &_m; - if (msg->ismultipart && msg->body.l) - list_destroy(msg->body.l, (list_item_destructor_t *)mm_destroy); + if (msg->ismultipart && msg->body.l) + list_contents_destroy(msg->body.l, (list_item_destructor_t *)mm_destroy); else if (msg->body.s) octstr_destroy(msg->body.s); } diff --git a/mbuni/mmlib/mms_util.c b/mbuni/mmlib/mms_util.c index e13fdf4..4b9396d 100644 --- a/mbuni/mmlib/mms_util.c +++ b/mbuni/mmlib/mms_util.c @@ -38,7 +38,6 @@ static Octstr *cfg_getx(CfgGroup *grp, Octstr *item) return v ? v : octstr_create(""); } - static void *load_module(CfgGroup *grp, char *config_key, char *symbolname) { Octstr *s; @@ -723,6 +722,17 @@ int mms_ind_send(Octstr *prov_cmd, Octstr *to) return res; } +void list_contents_destroy(List *list, list_item_destructor_t *destructor) +{ + if (!list) + return; + + int ll = list_len(list), lc; + + for(lc=0;lc