projects
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Harmonize pointer printing and size_t-fy casts.
[openssl.git]
/
crypto
/
mem_dbg.c
diff --git
a/crypto/mem_dbg.c
b/crypto/mem_dbg.c
index 402df01fadfc297fbc692bd774921e673d12e402..2cd116991822accf3c45b5dd679fbda132d954df 100644
(file)
--- a/
crypto/mem_dbg.c
+++ b/
crypto/mem_dbg.c
@@
-112,7
+112,7
@@
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
-#include "cryptlib.h"
+#include "
internal/
cryptlib.h"
#include <openssl/crypto.h>
#include <openssl/buffer.h>
#include <openssl/bio.h>
#include <openssl/crypto.h>
#include <openssl/buffer.h>
#include <openssl/bio.h>
@@
-197,10
+197,10
@@
static CRYPTO_THREADID disabling_threadid;
static void app_info_free(APP_INFO *inf)
{
static void app_info_free(APP_INFO *inf)
{
+ if (!inf)
+ return;
if (--(inf->references) <= 0) {
if (--(inf->references) <= 0) {
- if (inf->next != NULL) {
- app_info_free(inf->next);
- }
+ app_info_free(inf->next);
OPENSSL_free(inf);
}
}
OPENSSL_free(inf);
}
}
@@
-321,9
+321,9
@@
static IMPLEMENT_LHASH_COMP_FN(mem, MEM)
static unsigned long mem_hash(const MEM *a)
{
static unsigned long mem_hash(const MEM *a)
{
-
unsigned long
ret;
+
size_t
ret;
- ret = (
unsigned long
)a->addr;
+ ret = (
size_t
)a->addr;
ret = ret * 17851 + (ret >> 14) * 7 + (ret >> 4) * 251;
return (ret);
ret = ret * 17851 + (ret >> 14) * 7 + (ret >> 4) * 251;
return (ret);
@@
-394,7
+394,7
@@
int CRYPTO_push_info_(const char *info, const char *file, int line)
if (is_MemCheck_on()) {
MemCheck_off(); /* obtain MALLOC2 lock */
if (is_MemCheck_on()) {
MemCheck_off(); /* obtain MALLOC2 lock */
- if ((ami = OPENSSL_malloc(sizeof(
APP_INFO
))) == NULL) {
+ if ((ami = OPENSSL_malloc(sizeof(
*ami
))) == NULL) {
ret = 0;
goto err;
}
ret = 0;
goto err;
}
@@
-478,7
+478,7
@@
void CRYPTO_dbg_malloc(void *addr, int num, const char *file, int line,
if (is_MemCheck_on()) {
MemCheck_off(); /* make sure we hold MALLOC2 lock */
if (is_MemCheck_on()) {
MemCheck_off(); /* make sure we hold MALLOC2 lock */
- if ((m = OPENSSL_malloc(sizeof(
MEM
))) == NULL) {
+ if ((m = OPENSSL_malloc(sizeof(
*m
))) == NULL) {
OPENSSL_free(addr);
MemCheck_on(); /* release MALLOC2 lock if num_disabled drops
* to 0 */
OPENSSL_free(addr);
MemCheck_on(); /* release MALLOC2 lock if num_disabled drops
* to 0 */
@@
-559,8
+559,7
@@
void CRYPTO_dbg_free(void *addr, int before_p)
fprintf(stderr, "LEVITTE_DEBUG_MEM: [%5ld] - 0x%p (%d)\n",
mp->order, mp->addr, mp->num);
#endif
fprintf(stderr, "LEVITTE_DEBUG_MEM: [%5ld] - 0x%p (%d)\n",
mp->order, mp->addr, mp->num);
#endif
- if (mp->app_info != NULL)
- app_info_free(mp->app_info);
+ app_info_free(mp->app_info);
OPENSSL_free(mp);
}
OPENSSL_free(mp);
}
@@
-662,8
+661,8
@@
static void print_leak_doall_arg(const MEM *m, MEM_LEAK *l)
bufp += strlen(bufp);
}
bufp += strlen(bufp);
}
- BIO_snprintf(bufp, BUF_REMAIN, "number=%d, address=%
08lX
\n",
- m->num,
(unsigned long)
m->addr);
+ BIO_snprintf(bufp, BUF_REMAIN, "number=%d, address=%
p
\n",
+ m->num, m->addr);
bufp += strlen(bufp);
BIO_puts(l->bio, buf);
bufp += strlen(bufp);
BIO_puts(l->bio, buf);
@@
-763,10
+762,8
@@
void CRYPTO_mem_leaks(BIO *b)
old_mh_mode = mh_mode;
mh_mode = CRYPTO_MEM_CHECK_OFF;
old_mh_mode = mh_mode;
mh_mode = CRYPTO_MEM_CHECK_OFF;
- if (mh != NULL) {
- lh_MEM_free(mh);
- mh = NULL;
- }
+ lh_MEM_free(mh);
+ mh = NULL;
if (amih != NULL) {
if (lh_APP_INFO_num_items(amih) == 0) {
lh_APP_INFO_free(amih);
if (amih != NULL) {
if (lh_APP_INFO_num_items(amih) == 0) {
lh_APP_INFO_free(amih);