Rename to OPENSSL_mem_debug_{push,pop}.
Remove simple calls; keep only calls used in recursive functions.
Ensure we always push, to simplify so that we can always pop
Reviewed-by: Richard Levitte <levitte@openssl.org>
asn1_cb = 0;
#ifdef CRYPTO_MDEBUG
- if (it->sname)
- CRYPTO_push_info(it->sname);
+ OPENSSL_mem_debug_push(it->sname ? it->sname : "asn1_item_embed_new");
#endif
switch (it->itype) {
goto auxerr;
if (i == 2) {
#ifdef CRYPTO_MDEBUG
- if (it->sname)
- CRYPTO_pop_info();
+ OPENSSL_mem_debug_pop();
#endif
return 1;
}
goto auxerr;
if (i == 2) {
#ifdef CRYPTO_MDEBUG
- if (it->sname)
- CRYPTO_pop_info();
+ OPENSSL_mem_debug_pop();
#endif
return 1;
}
break;
}
#ifdef CRYPTO_MDEBUG
- if (it->sname)
- CRYPTO_pop_info();
+ OPENSSL_mem_debug_pop();
#endif
return 1;
memerr:
ASN1err(ASN1_F_ASN1_ITEM_EMBED_NEW, ERR_R_MALLOC_FAILURE);
#ifdef CRYPTO_MDEBUG
- if (it->sname)
- CRYPTO_pop_info();
+ OPENSSL_mem_debug_pop();
#endif
return 0;
ASN1err(ASN1_F_ASN1_ITEM_EMBED_NEW, ASN1_R_AUX_ERROR);
ASN1_item_ex_free(pval, it);
#ifdef CRYPTO_MDEBUG
- if (it->sname)
- CRYPTO_pop_info();
+ OPENSSL_mem_debug_pop();
#endif
return 0;
return 1;
}
#ifdef CRYPTO_MDEBUG
- if (tt->field_name)
- CRYPTO_push_info(tt->field_name);
+ OPENSSL_mem_debug_push(tt->field_name
+ ? tt->field_name : "asn1_template_new");
#endif
/* If SET OF or SEQUENCE OF, its a STACK */
if (tt->flags & ASN1_TFLG_SK_MASK) {
ret = asn1_item_embed_new(pval, it, embed);
done:
#ifdef CRYPTO_MDEBUG
- if (it->sname)
- CRYPTO_pop_info();
+ OPENSSL_mem_debug_pop();
#endif
return ret;
}
int ignored;
dynbuf = NULL;
- CRYPTO_push_info("doapr()");
_dopr(&hugebufp, &dynbuf, &hugebufsize, &retlen, &ignored, format, args);
if (dynbuf) {
ret = BIO_write(bio, dynbuf, (int)retlen);
} else {
ret = BIO_write(bio, hugebuf, (int)retlen);
}
- CRYPTO_pop_info();
return (ret);
}
if (lockit)
CRYPTO_w_lock(CRYPTO_LOCK_ERR);
if (!int_error_hash && create) {
- CRYPTO_push_info("get_hash (err.c)");
int_error_hash = lh_ERR_STRING_DATA_new();
- CRYPTO_pop_info();
}
if (int_error_hash != NULL)
ret = int_error_hash;
if (lockit)
CRYPTO_w_lock(CRYPTO_LOCK_ERR);
if (!int_thread_hash && create) {
- CRYPTO_push_info("int_thread_get (err.c)");
int_thread_hash = lh_ERR_STATE_new();
- CRYPTO_pop_info();
}
if (int_thread_hash != NULL) {
int_thread_hash_references++;
* For application-defined information (static C-string `info')
* to be displayed in memory leak list.
* Each thread has its own stack. For applications, there is
- * CRYPTO_push_info("...") to push an entry,
- * CRYPTO_pop_info() to pop an entry,
- * CRYPTO_remove_all_info() to pop all entries.
+ * OPENSSL_mem_debug_push("...") to push an entry,
+ * OPENSSL_mem_debug_pop() to pop an entry,
*/
{
CRYPTO_THREADID threadid;
return (ret);
}
-int CRYPTO_push_info_(const char *info, const char *file, int line)
+int CRYPTO_mem_debug_push(const char *info, const char *file, int line)
{
APP_INFO *ami, *amim;
int ret = 0;
return (ret);
}
-int CRYPTO_pop_info(void)
+int CRYPTO_mem_debug_pop(void)
{
int ret = 0;
return (ret);
}
-int CRYPTO_remove_all_info(void)
-{
- int ret = 0;
-
- if (is_MemCheck_on()) { /* _must_ be true */
- MemCheck_off(); /* obtain MALLOC2 lock */
-
- while (pop_info() != NULL)
- ret++;
-
- MemCheck_on(); /* release MALLOC2 lock */
- }
- return (ret);
-}
-
static unsigned long break_order_num = 0;
void CRYPTO_dbg_malloc(void *addr, size_t num, const char *file, int line,
int before_p)
void CRYPTO_set_mem_debug_options(long bits);
long CRYPTO_get_mem_debug_options(void);
-# define CRYPTO_push_info(info) \
- CRYPTO_push_info_(info, __FILE__, __LINE__);
-int CRYPTO_push_info_(const char *info, const char *file, int line);
-int CRYPTO_pop_info(void);
-int CRYPTO_remove_all_info(void);
+# define OPENSSL_mem_debug_push(info) \
+ CRYPTO_mem_debug_push(info, __FILE__, __LINE__)
+# define OPENSSL_mem_debug_pop() \
+ CRYPTO_mem_debug_pop()
+int CRYPTO_mem_debug_push(const char *info, const char *file, int line);
+int CRYPTO_mem_debug_pop(void);
/*
* Default debugging functions (enabled by CRYPTO_malloc_debug_init() macro;
PKCS7_sign 2155 1_1_0 EXIST::FUNCTION:
PKCS7_add_attrib_smimecap 2156 1_1_0 EXIST::FUNCTION:
CRYPTO_dbg_set_options 2157 1_1_0 EXIST::FUNCTION:
-CRYPTO_remove_all_info 2158 1_1_0 EXIST::FUNCTION:
+CRYPTO_remove_all_info 2158 1_1_0 NOEXIST::FUNCTION:
CRYPTO_get_mem_debug_functions 2159 1_1_0 EXIST::FUNCTION:
CRYPTO_is_mem_check_on 2160 1_1_0 EXIST::FUNCTION:
CRYPTO_set_mem_debug_functions 2161 1_1_0 EXIST::FUNCTION:
-CRYPTO_pop_info 2162 1_1_0 EXIST::FUNCTION:
-CRYPTO_push_info_ 2163 1_1_0 EXIST::FUNCTION:
+CRYPTO_mem_debug_pop 2162 1_1_0 EXIST::FUNCTION:
+CRYPTO_mem_debug_push 2163 1_1_0 EXIST::FUNCTION:
CRYPTO_set_mem_debug_options 2164 1_1_0 EXIST::FUNCTION:
PEM_write_PKCS8PrivateKey_nid 2165 1_1_0 EXIST::FUNCTION:STDIO
PEM_write_bio_PKCS8PrivateKey_nid 2166 1_1_0 EXIST:!VMS:FUNCTION: