set free'd poiners to NULL

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@12593 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Johan Danielsson
2003-08-20 16:18:49 +00:00
parent 06bf50701a
commit e368fa330b
2 changed files with 9 additions and 4 deletions

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997 - 2001 Kungliga Tekniska H<>gskolan * Copyright (c) 1997 - 2003 Kungliga Tekniska H<>gskolan
* (Royal Institute of Technology, Stockholm, Sweden). * (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved. * All rights reserved.
* *
@@ -39,16 +39,19 @@ void
free_general_string (heim_general_string *str) free_general_string (heim_general_string *str)
{ {
free(*str); free(*str);
*str = NULL;
} }
void void
free_octet_string (heim_octet_string *k) free_octet_string (heim_octet_string *k)
{ {
free(k->data); free(k->data);
k->data = NULL;
} }
void void
free_oid (heim_oid *k) free_oid (heim_oid *k)
{ {
free(k->components); free(k->components);
k->components = NULL;
} }

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997 - 2000 Kungliga Tekniska H<>gskolan * Copyright (c) 1997 - 2003 Kungliga Tekniska H<>gskolan
* (Royal Institute of Technology, Stockholm, Sweden). * (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved. * All rights reserved.
* *
@@ -82,7 +82,8 @@ free_type (const char *name, const Type *t)
if(m->optional) if(m->optional)
fprintf(codefile, fprintf(codefile,
"free(%s);\n" "free(%s);\n"
"}\n",s); "%s = NULL;\n"
"}\n", s, s);
if (tag == -1) if (tag == -1)
tag = m->val; tag = m->val;
free (s); free (s);
@@ -100,7 +101,8 @@ free_type (const char *name, const Type *t)
"}\n", "}\n",
name); name);
fprintf(codefile, fprintf(codefile,
"free((%s)->val);\n", name); "free((%s)->val);\n"
"(%s)->val = NULL;\n", name, name);
free(n); free(n);
break; break;
} }