summaryrefslogtreecommitdiff
path: root/accel-pptpd/radius/dict.c
diff options
context:
space:
mode:
authorDmitry Kozlov <xeb@mail.ru>2010-09-20 01:09:07 +0400
committerDmitry Kozlov <xeb@mail.ru>2010-09-20 01:09:34 +0400
commitb96fbc3f966b012720d2b74b1dfd2a0ab95086cf (patch)
tree606750874faf65029f756dc0b401ee40cc4da89f /accel-pptpd/radius/dict.c
parentd860a4beaf5f99d5045d03b931b4829426a2f7b0 (diff)
downloadaccel-ppp-b96fbc3f966b012720d2b74b1dfd2a0ab95086cf.tar.gz
accel-ppp-b96fbc3f966b012720d2b74b1dfd2a0ab95086cf.zip
fixed many bugs and memory leaks
Diffstat (limited to 'accel-pptpd/radius/dict.c')
-rw-r--r--accel-pptpd/radius/dict.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/accel-pptpd/radius/dict.c b/accel-pptpd/radius/dict.c
index bd7a4ef..54cf895 100644
--- a/accel-pptpd/radius/dict.c
+++ b/accel-pptpd/radius/dict.c
@@ -8,6 +8,8 @@
#include "radius_p.h"
#include "log.h"
+#include "memdebug.h"
+
static struct rad_dict_t *dict;
static char *skip_word(char *ptr)
@@ -216,19 +218,19 @@ int rad_dict_load(const char *fname)
INIT_LIST_HEAD(&dict->items);
INIT_LIST_HEAD(&dict->vendors);
- path = malloc(PATH_MAX);
+ path = _malloc(PATH_MAX);
if (!path) {
log_emerg("radius: out of memory\n");
goto out_free_dict;
}
- fname1 = malloc(PATH_MAX);
+ fname1 = _malloc(PATH_MAX);
if (!fname1) {
log_emerg("radius: out of memory\n");
goto out_free_path;
}
- buf = malloc(BUF_SIZE);
+ buf = _malloc(BUF_SIZE);
if (!buf) {
log_emerg("radius: out of memory\n");
goto out_free_fname1;
@@ -239,9 +241,9 @@ int rad_dict_load(const char *fname)
r = dict_load(fname);
out_free_fname1:
- free(fname1);
+ _free(fname1);
out_free_path:
- free(path);
+ _free(path);
out_free_dict:
if (r)
rad_dict_free(dict);
@@ -258,16 +260,16 @@ void rad_dict_free(struct rad_dict_t *dict)
while (!list_empty(&attr->values)) {
val = list_entry(attr->values.next, typeof(*val), entry);
list_del(&val->entry);
- free((char*)val->name);
+ _free((char*)val->name);
if (attr->type == ATTR_TYPE_STRING)
- free((char*)val->val.string);
- free(val);
+ _free((char*)val->val.string);
+ _free(val);
}
list_del(&attr->entry);
- free((char*)attr->name);
- free(attr);
+ _free((char*)attr->name);
+ _free(attr);
}
- free(dict);
+ _free(dict);
}
static struct rad_dict_attr_t *dict_find_attr(struct list_head *items, const char *name)