diff options
author | Nick Mathewson <nickm@torproject.org> | 2005-09-30 20:47:58 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2005-09-30 20:47:58 +0000 |
commit | de198d800b42218a424d44179ea2881d6dfbf975 (patch) | |
tree | 8c1de7020eb5a5d0df125ad4619255f41304d501 /src/common | |
parent | 364fd1ccdffe4a8f6c46137366e4c673b26b453c (diff) | |
download | tor-de198d800b42218a424d44179ea2881d6dfbf975.tar.gz tor-de198d800b42218a424d44179ea2881d6dfbf975.zip |
Never call free() on tor_malloc()d memory. This is unlikely to be our current leak, but it may help dmalloc work.
svn:r5168
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/aes.c | 2 | ||||
-rw-r--r-- | src/common/container.c | 4 | ||||
-rw-r--r-- | src/common/crypto.c | 14 | ||||
-rw-r--r-- | src/common/tortls.c | 2 |
4 files changed, 11 insertions, 11 deletions
diff --git a/src/common/aes.c b/src/common/aes.c index b4dd774755..71250cd0c5 100644 --- a/src/common/aes.c +++ b/src/common/aes.c @@ -157,7 +157,7 @@ aes_free_cipher(aes_cnt_cipher_t *cipher) { assert(cipher); memset(cipher, 0, sizeof(cipher)); - free(cipher); + tor_free(cipher); } /** Encrypt <b>len</b> bytes from <b>input</b>, storing the result in diff --git a/src/common/container.c b/src/common/container.c index 39cabe9c5d..88f0ca4336 100644 --- a/src/common/container.c +++ b/src/common/container.c @@ -58,8 +58,8 @@ smartlist_create(void) void smartlist_free(smartlist_t *sl) { - free(sl->list); - free(sl); + tor_free(sl->list); + tor_free(sl); } /** Change the capacity of the smartlist to <b>n</b>, so that we can grow diff --git a/src/common/crypto.c b/src/common/crypto.c index 38e9931f88..eaa002e7ba 100644 --- a/src/common/crypto.c +++ b/src/common/crypto.c @@ -323,7 +323,7 @@ crypto_free_pk_env(crypto_pk_env_t *env) if (env->key) RSA_free(env->key); - free(env); + tor_free(env); } /** Create a new symmetric cipher for a given key and encryption flag @@ -561,7 +561,7 @@ crypto_pk_write_private_key_to_filename(crypto_pk_env_t *env, s[len]='\0'; r = write_str_to_file(fname, s, 0); BIO_free(bio); - free(s); + tor_free(s); return r; } @@ -1032,14 +1032,14 @@ crypto_pk_get_digest(crypto_pk_env_t *pk, char *digest_out) len = i2d_RSAPublicKey(pk->key, &bufp); if (len < 0) { crypto_log_errors(LOG_WARN,"encoding public key"); - free(buf); + tor_free(buf); return -1; } if (crypto_digest(digest_out, (char*)buf, len) < 0) { - free(buf); + tor_free(buf); return -1; } - free(buf); + tor_free(buf); return 0; } @@ -1367,7 +1367,7 @@ crypto_dh_new(void) err: crypto_log_errors(LOG_WARN, "creating DH object"); if (res && res->dh) DH_free(res->dh); /* frees p and g too */ - if (res) free(res); + if (res) tor_free(res); return NULL; } @@ -1564,7 +1564,7 @@ crypto_dh_free(crypto_dh_env_t *dh) tor_assert(dh); tor_assert(dh->dh); DH_free(dh->dh); - free(dh); + tor_free(dh); } /* random numbers */ diff --git a/src/common/tortls.c b/src/common/tortls.c index d2b0d7080d..84bcf5a5a9 100644 --- a/src/common/tortls.c +++ b/src/common/tortls.c @@ -408,7 +408,7 @@ tor_tls_context_new(crypto_pk_env_t *identity, if (result && result->client_only_ctx) SSL_CTX_free(result->client_only_ctx); if (result) - free(result); + tor_free(result); if (cert) X509_free(cert); if (idcert) |