From: Peter Verthez Date: Sat, 21 Sep 2002 07:42:47 +0000 (+0000) Subject: Clean up environment at exit. X-Git-Url: https://git.dlugolecki.net.pl/?a=commitdiff_plain;h=d2035760540dc564416171d40196bfc364b82e54;p=gedcom-parse.git Clean up environment at exit. --- diff --git a/gedcom/encoding.c b/gedcom/encoding.c index 07a9589..b5e2b40 100644 --- a/gedcom/encoding.c +++ b/gedcom/encoding.c @@ -107,9 +107,15 @@ char* get_encoding(const char* gedcom_n, ENCODING enc) } } +static char *new_gconv_path; + void cleanup_encodings() { hash_free(encodings); + /* Clean up environment */ + putenv(GCONV_SEARCH_PATH); + if (new_gconv_path) + free(new_gconv_path); } /* Let function be called before main() */ @@ -140,7 +146,6 @@ void update_gconv_search_path() /* Add gedcom data directory to gconv search path */ gconv_path = getenv(GCONV_SEARCH_PATH); if (gconv_path == NULL || strstr(gconv_path, PKGDATADIR) == NULL) { - char *new_gconv_path; if (gconv_path == NULL) { new_gconv_path = (char *)malloc(strlen(GCONV_SEARCH_PATH) + strlen(PKGDATADIR)