Add INFO verbosity level

and use it for reporting CRYPTO_malloc and CRYPTO_free invocations.

Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
diff --git a/preload.c b/preload.c
index 4834036..55c9979 100644
--- a/preload.c
+++ b/preload.c
@@ -30,7 +30,8 @@
 
 static int debug = 0;
 
-#define DEBUG(...) do { if (debug) printf(__VA_ARGS__); } while(0)
+#define DEBUG(...) do { if (debug > 1) printf(__VA_ARGS__); } while(0)
+#define INFO(...) do { if (debug) printf(__VA_ARGS__); } while(0)
 
 #define PINUSE_BIT	0x01
 #define CINUSE_BIT	0x02
@@ -163,7 +164,7 @@
 	struct segptr *seg;
 	int i;
 
-	if (!debug)
+	if (debug < 2)
 		return;
 
 	for (i = 0, seg = m.seg; seg != NULL; i++, seg = seg->next) {
@@ -241,7 +242,7 @@
 	 */
 	ASSERT(sizeof(struct malloc_chunk) < MIN_CHUNK);
 	if (getenv("MALLOC_DEBUG") != NULL)
-		debug = 1;
+		debug = atoi(getenv("MALLOC_DEBUG"));
 	if (getenv("NO_SECRET_MEM") != NULL)
 		use_secret = 0;
 
@@ -326,7 +327,7 @@
 	void *ret = NULL;
 	if (size < SEG_SIZE)
 		ret = dlmalloc(size);
-	DEBUG("in crypto malloc from %s:%d size=%x ret=%p\n", file, line, size, ret);
+	INFO("in crypto malloc from %s:%d size=%x ret=%p\n", file, line, size, ret);
 	show_segment();
 	return ret;
 }
@@ -335,7 +336,7 @@
 {
 	struct malloc_chunk *c, *n;
 
-	DEBUG("in crypto free from %s:%d; ptr=%p\n", file, line, ptr);
+	INFO("in crypto free from %s:%d; ptr=%p\n", file, line, ptr);
 	if (ptr == NULL)
 		return;