REVERT: add and use der_{malloc,free}

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@22429 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2008-01-13 10:25:50 +00:00
parent f8574e2b52
commit 731d6e6df8
4 changed files with 5 additions and 17 deletions

View File

@@ -50,14 +50,14 @@ typedef struct heim_octet_string heim_any_set;
#define ASN1_MALLOC_ENCODE(T, B, BL, S, L, R) \
do { \
(BL) = length_##T((S)); \
(B) = der_malloc((BL)); \
(B) = malloc((BL)); \
if((B) == NULL) { \
(R) = ENOMEM; \
} else { \
(R) = encode_##T(((unsigned char*)(B)) + (BL) - 1, (BL), \
(S), (L)); \
if((R) != 0) { \
der_free((B)); \
free((B)); \
(B) = NULL; \
} \
} \

View File

@@ -140,15 +140,3 @@ der_get_tag_num(const char *name)
{
return get_type(name, tag_names, SIZEOF_ARRAY(tag_names));
}
void
der_free(void *ptr)
{
free(ptr);
}
void *
der_malloc(size_t size)
{
return malloc(size);
}

View File

@@ -154,14 +154,14 @@ init_generate (const char *filename, const char *base)
fputs("#define ASN1_MALLOC_ENCODE(T, B, BL, S, L, R) \\\n"
" do { \\\n"
" (BL) = length_##T((S)); \\\n"
" (B) = der_malloc((BL)); \\\n"
" (B) = malloc((BL)); \\\n"
" if((B) == NULL) { \\\n"
" (R) = ENOMEM; \\\n"
" } else { \\\n"
" (R) = encode_##T(((unsigned char*)(B)) + (BL) - 1, (BL), \\\n"
" (S), (L)); \\\n"
" if((R) != 0) { \\\n"
" der_free((B)); \\\n"
" free((B)); \\\n"
" (B) = NULL; \\\n"
" } \\\n"
" } \\\n"

View File

@@ -316,7 +316,7 @@ encode_type (const char *name, const Type *t, const char *tmpstr)
"if(eret) {\n"
"i--;\n"
"while (i >= 0) {\n"
"der_free(val[i].data);\n"
"free(val[i].data);\n"
"i--;\n"
"}\n"
"free(val);\n"