ssl/ssl_ciph.c:1894: error: NULL_DEREFERENCE
  pointer `comp` last assigned on line 1893 could be null and is dereferenced at line 1894, column 2.
Showing all 44 steps of the trace


ssl/ssl_ciph.c:1873:1: start of procedure SSL_COMP_add_compression_method()
1871.   	}
1872.   
1873. > int SSL_COMP_add_compression_method(int id, COMP_METHOD *cm)
1874.   	{
1875.   	SSL_COMP *comp;

ssl/ssl_ciph.c:1877:13: Taking false branch
1875.   	SSL_COMP *comp;
1876.   
1877.           if (cm == NULL || cm->type == NID_undef)
                    ^
1878.                   return 1;
1879.   

ssl/ssl_ciph.c:1877:27: Taking false branch
1875.   	SSL_COMP *comp;
1876.   
1877.           if (cm == NULL || cm->type == NID_undef)
                                  ^
1878.                   return 1;
1879.   

ssl/ssl_ciph.c:1886:6: Taking false branch
1884.   	   64 to 192:  external party methods assigned by IANA
1885.   	   193 to 255: reserved for private use */
1886.   	if (id < 193 || id > 255)
             ^
1887.   		{
1888.   		SSLerr(SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD,SSL_R_COMPRESSION_ID_NOT_WITHIN_PRIVATE_RANGE);

ssl/ssl_ciph.c:1886:18: Taking false branch
1884.   	   64 to 192:  external party methods assigned by IANA
1885.   	   193 to 255: reserved for private use */
1886.   	if (id < 193 || id > 255)
                         ^
1887.   		{
1888.   		SSLerr(SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD,SSL_R_COMPRESSION_ID_NOT_WITHIN_PRIVATE_RANGE);

ssl/ssl_ciph.c:1892:2: 
1890.   		}
1891.   
1892. > 	MemCheck_off();
1893.   	comp=(SSL_COMP *)OPENSSL_malloc(sizeof(SSL_COMP));
1894.   	comp->id=id;

crypto/mem_dbg.c:216:1: start of procedure CRYPTO_mem_ctrl()
  214.   	}
  215.   
  216. > int CRYPTO_mem_ctrl(int mode)
  217.   	{
  218.   	int ret=mh_mode;

crypto/mem_dbg.c:218:2: 
  216.   int CRYPTO_mem_ctrl(int mode)
  217.   	{
  218. > 	int ret=mh_mode;
  219.   
  220.   	CRYPTO_w_lock(CRYPTO_LOCK_MALLOC);

crypto/mem_dbg.c:220:2: 
  218.   	int ret=mh_mode;
  219.   
  220. > 	CRYPTO_w_lock(CRYPTO_LOCK_MALLOC);
  221.   	switch (mode)
  222.   		{

crypto/lock.c:426:1: start of procedure CRYPTO_lock()
    424.   	}
    425.   
    426. > void CRYPTO_lock(int mode, int type, const char *file, int line)
    427.   	{
    428.   #ifdef LOCK_DEBUG

crypto/lock.c:453:6: Taking false branch
    451.   		}
    452.   #endif
    453.   	if (type < 0)
                ^
    454.   		{
    455.   		if (dynlock_lock_callback != NULL)

crypto/lock.c:468:7: Taking true branch
    466.   		}
    467.   	else
    468.   		if (locking_callback != NULL)
                 ^
    469.   			locking_callback(mode,type,file,line);
    470.   	}

crypto/lock.c:469:4: Skipping __function_pointer__(): unresolved function pointer
    467.   	else
    468.   		if (locking_callback != NULL)
    469.   			locking_callback(mode,type,file,line);
              ^
    470.   	}
    471.   

crypto/lock.c:453:2: 
    451.   		}
    452.   #endif
    453. > 	if (type < 0)
    454.   		{
    455.   		if (dynlock_lock_callback != NULL)

crypto/lock.c:470:2: return from a call to CRYPTO_lock
    468.   		if (locking_callback != NULL)
    469.   			locking_callback(mode,type,file,line);
    470.   	}
            ^
    471.   
    472.   int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file,

crypto/mem_dbg.c:221:2: 
  219.   
  220.   	CRYPTO_w_lock(CRYPTO_LOCK_MALLOC);
  221. > 	switch (mode)
  222.   		{
  223.   	/* for applications (not to be called while multiple threads

crypto/mem_dbg.c:225:2: Switch condition is false. Skipping switch case
  223.   	/* for applications (not to be called while multiple threads
  224.   	 * use the library): */
  225.   	case CRYPTO_MEM_CHECK_ON: /* aka MemCheck_start() */
          ^
  226.   		mh_mode = CRYPTO_MEM_CHECK_ON|CRYPTO_MEM_CHECK_ENABLE;
  227.   		num_disable = 0;

crypto/mem_dbg.c:229:2: Switch condition is false. Skipping switch case
  227.   		num_disable = 0;
  228.   		break;
  229.   	case CRYPTO_MEM_CHECK_OFF: /* aka MemCheck_stop() */
          ^
  230.   		mh_mode = 0;
  231.   		num_disable = 0; /* should be true *before* MemCheck_stop is used,

crypto/mem_dbg.c:236:2: Switch condition is true. Entering switch case
  234.   
  235.   	/* switch off temporarily (for library-internal use): */
  236.   	case CRYPTO_MEM_CHECK_DISABLE: /* aka MemCheck_off() */
          ^
  237.   		if (mh_mode & CRYPTO_MEM_CHECK_ON)
  238.   			{

crypto/mem_dbg.c:237:7: Taking false branch
  235.   	/* switch off temporarily (for library-internal use): */
  236.   	case CRYPTO_MEM_CHECK_DISABLE: /* aka MemCheck_off() */
  237.   		if (mh_mode & CRYPTO_MEM_CHECK_ON)
               ^
  238.   			{
  239.   			CRYPTO_THREADID cur;

crypto/mem_dbg.c:282:2: 
  280.   		break;
  281.   		}
  282. > 	CRYPTO_w_unlock(CRYPTO_LOCK_MALLOC);
  283.   	return(ret);
  284.   	}

crypto/lock.c:426:1: start of procedure CRYPTO_lock()
    424.   	}
    425.   
    426. > void CRYPTO_lock(int mode, int type, const char *file, int line)
    427.   	{
    428.   #ifdef LOCK_DEBUG

crypto/lock.c:453:6: Taking false branch
    451.   		}
    452.   #endif
    453.   	if (type < 0)
                ^
    454.   		{
    455.   		if (dynlock_lock_callback != NULL)

crypto/lock.c:468:7: Taking true branch
    466.   		}
    467.   	else
    468.   		if (locking_callback != NULL)
                 ^
    469.   			locking_callback(mode,type,file,line);
    470.   	}

crypto/lock.c:469:4: Skipping __function_pointer__(): unresolved function pointer
    467.   	else
    468.   		if (locking_callback != NULL)
    469.   			locking_callback(mode,type,file,line);
              ^
    470.   	}
    471.   

crypto/lock.c:453:2: 
    451.   		}
    452.   #endif
    453. > 	if (type < 0)
    454.   		{
    455.   		if (dynlock_lock_callback != NULL)

crypto/lock.c:470:2: return from a call to CRYPTO_lock
    468.   		if (locking_callback != NULL)
    469.   			locking_callback(mode,type,file,line);
    470.   	}
            ^
    471.   
    472.   int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file,

crypto/mem_dbg.c:283:2: 
  281.   		}
  282.   	CRYPTO_w_unlock(CRYPTO_LOCK_MALLOC);
  283. > 	return(ret);
  284.   	}
  285.   

crypto/mem_dbg.c:284:2: return from a call to CRYPTO_mem_ctrl
  282.   	CRYPTO_w_unlock(CRYPTO_LOCK_MALLOC);
  283.   	return(ret);
  284.   	}
          ^
  285.   
  286.   int CRYPTO_is_mem_check_on(void)

ssl/ssl_ciph.c:1893:2: 
1891.   
1892.   	MemCheck_off();
1893. > 	comp=(SSL_COMP *)OPENSSL_malloc(sizeof(SSL_COMP));
1894.   	comp->id=id;
1895.   	comp->method=cm;

crypto/mem.c:295:1: start of procedure CRYPTO_malloc()
  293.   	}
  294.   
  295. > void *CRYPTO_malloc(int num, const char *file, int line)
  296.   	{
  297.   	void *ret = NULL;

crypto/mem.c:297:2: 
  295.   void *CRYPTO_malloc(int num, const char *file, int line)
  296.   	{
  297. > 	void *ret = NULL;
  298.   
  299.   	if (num <= 0) return NULL;

crypto/mem.c:299:6: Taking false branch
  297.   	void *ret = NULL;
  298.   
  299.   	if (num <= 0) return NULL;
              ^
  300.   
  301.   	allow_customize = 0;

crypto/mem.c:301:2: 
  299.   	if (num <= 0) return NULL;
  300.   
  301. > 	allow_customize = 0;
  302.   	if (malloc_debug_func != NULL)
  303.   		{

crypto/mem.c:302:6: Taking true branch
  300.   
  301.   	allow_customize = 0;
  302.   	if (malloc_debug_func != NULL)
              ^
  303.   		{
  304.   		allow_customize_debug = 0;

crypto/mem.c:304:3: 
  302.   	if (malloc_debug_func != NULL)
  303.   		{
  304. > 		allow_customize_debug = 0;
  305.   		malloc_debug_func(NULL, num, file, line, 0);
  306.   		}

crypto/mem.c:305:3: Skipping __function_pointer__(): unresolved function pointer
  303.   		{
  304.   		allow_customize_debug = 0;
  305.   		malloc_debug_func(NULL, num, file, line, 0);
           ^
  306.   		}
  307.   	ret = malloc_ex_func(num,file,line);

crypto/mem.c:307:2: Skipping __function_pointer__(): unresolved function pointer
  305.   		malloc_debug_func(NULL, num, file, line, 0);
  306.   		}
  307.   	ret = malloc_ex_func(num,file,line);
          ^
  308.   #ifdef LEVITTE_DEBUG_MEM
  309.   	fprintf(stderr, "LEVITTE_DEBUG_MEM:         > 0x%p (%d)\n", ret, num);

crypto/mem.c:311:6: Taking true branch
  309.   	fprintf(stderr, "LEVITTE_DEBUG_MEM:         > 0x%p (%d)\n", ret, num);
  310.   #endif
  311.   	if (malloc_debug_func != NULL)
              ^
  312.   		malloc_debug_func(ret, num, file, line, 1);
  313.   

crypto/mem.c:312:3: Skipping __function_pointer__(): unresolved function pointer
  310.   #endif
  311.   	if (malloc_debug_func != NULL)
  312.   		malloc_debug_func(ret, num, file, line, 1);
           ^
  313.   
  314.   #ifndef OPENSSL_CPUID_OBJ

crypto/mem.c:318:12: Taking false branch
  316.            * sanitisation function can't be optimised out. NB: We only do
  317.            * this for >2Kb so the overhead doesn't bother us. */
  318.           if(ret && (num > 2048))
                    ^
  319.   	{	extern unsigned char cleanse_ctr;
  320.                   ((unsigned char *)ret)[0] = cleanse_ctr;

crypto/mem.c:324:2: 
  322.   #endif
  323.   
  324. > 	return ret;
  325.   	}
  326.   char *CRYPTO_strdup(const char *str, const char *file, int line)

crypto/mem.c:325:2: return from a call to CRYPTO_malloc
  323.   
  324.   	return ret;
  325.   	}
          ^
  326.   char *CRYPTO_strdup(const char *str, const char *file, int line)
  327.   	{

ssl/ssl_ciph.c:1894:2: 
1892.   	MemCheck_off();
1893.   	comp=(SSL_COMP *)OPENSSL_malloc(sizeof(SSL_COMP));
1894. > 	comp->id=id;
1895.   	comp->method=cm;
1896.   	load_builtin_compressions();

int SSL_COMP_add_compression_method(int id, COMP_METHOD *cm)
	{
	SSL_COMP *comp;
        if (cm == NULL || cm->type == NID_undef)
                return 1;
	if (id < 193 || id > 255)
		{
		SSLerr(SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD,SSL_R_COMPRESSION_ID_NOT_WITHIN_PRIVATE_RANGE);
		return 0;
		}
	MemCheck_off();
	comp=(SSL_COMP *)OPENSSL_malloc(sizeof(SSL_COMP));
	comp->id=id;
	comp->method=cm;
	load_builtin_compressions();
	if (ssl_comp_methods
		&& sk_SSL_COMP_find(ssl_comp_methods,comp) >= 0)
		{
		OPENSSL_free(comp);
		MemCheck_on();
		SSLerr(SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD,SSL_R_DUPLICATE_COMPRESSION_ID);
		return(1);
		}
	else if ((ssl_comp_methods == NULL)
		|| !sk_SSL_COMP_push(ssl_comp_methods,comp))
		{
		OPENSSL_free(comp);
		MemCheck_on();
		SSLerr(SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD,ERR_R_MALLOC_FAILURE);
		return(1);
		}
	else
		{
		MemCheck_on();
		return(0);
		}
	}
['int SSL_COMP_add_compression_method(int id, COMP_METHOD *cm)\n\t{\n\tSSL_COMP *comp;\n        if (cm == NULL || cm->type == NID_undef)\n                return 1;\n\tif (id < 193 || id > 255)\n\t\t{\n\t\tSSLerr(SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD,SSL_R_COMPRESSION_ID_NOT_WITHIN_PRIVATE_RANGE);\n\t\treturn 0;\n\t\t}\n\tMemCheck_off();\n\tcomp=(SSL_COMP *)OPENSSL_malloc(sizeof(SSL_COMP));\n\tcomp->id=id;\n\tcomp->method=cm;\n\tload_builtin_compressions();\n\tif (ssl_comp_methods\n\t\t&& sk_SSL_COMP_find(ssl_comp_methods,comp) >= 0)\n\t\t{\n\t\tOPENSSL_free(comp);\n\t\tMemCheck_on();\n\t\tSSLerr(SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD,SSL_R_DUPLICATE_COMPRESSION_ID);\n\t\treturn(1);\n\t\t}\n\telse if ((ssl_comp_methods == NULL)\n\t\t|| !sk_SSL_COMP_push(ssl_comp_methods,comp))\n\t\t{\n\t\tOPENSSL_free(comp);\n\t\tMemCheck_on();\n\t\tSSLerr(SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD,ERR_R_MALLOC_FAILURE);\n\t\treturn(1);\n\t\t}\n\telse\n\t\t{\n\t\tMemCheck_on();\n\t\treturn(0);\n\t\t}\n\t}', 'int CRYPTO_mem_ctrl(int mode)\n\t{\n\tint ret=mh_mode;\n\tCRYPTO_w_lock(CRYPTO_LOCK_MALLOC);\n\tswitch (mode)\n\t\t{\n\tcase CRYPTO_MEM_CHECK_ON:\n\t\tmh_mode = CRYPTO_MEM_CHECK_ON|CRYPTO_MEM_CHECK_ENABLE;\n\t\tnum_disable = 0;\n\t\tbreak;\n\tcase CRYPTO_MEM_CHECK_OFF:\n\t\tmh_mode = 0;\n\t\tnum_disable = 0;\n\t\tbreak;\n\tcase CRYPTO_MEM_CHECK_DISABLE:\n\t\tif (mh_mode & CRYPTO_MEM_CHECK_ON)\n\t\t\t{\n\t\t\tCRYPTO_THREADID cur;\n\t\t\tCRYPTO_THREADID_current(&cur);\n\t\t\tif (!num_disable || CRYPTO_THREADID_cmp(&disabling_threadid, &cur))\n\t\t\t\t{\n\t\t\t\tCRYPTO_w_unlock(CRYPTO_LOCK_MALLOC);\n\t\t\t\tCRYPTO_w_lock(CRYPTO_LOCK_MALLOC2);\n\t\t\t\tCRYPTO_w_lock(CRYPTO_LOCK_MALLOC);\n\t\t\t\tmh_mode &= ~CRYPTO_MEM_CHECK_ENABLE;\n\t\t\t\tCRYPTO_THREADID_cpy(&disabling_threadid, &cur);\n\t\t\t\t}\n\t\t\tnum_disable++;\n\t\t\t}\n\t\tbreak;\n\tcase CRYPTO_MEM_CHECK_ENABLE:\n\t\tif (mh_mode & CRYPTO_MEM_CHECK_ON)\n\t\t\t{\n\t\t\tif (num_disable)\n\t\t\t\t{\n\t\t\t\tnum_disable--;\n\t\t\t\tif (num_disable == 0)\n\t\t\t\t\t{\n\t\t\t\t\tmh_mode|=CRYPTO_MEM_CHECK_ENABLE;\n\t\t\t\t\tCRYPTO_w_unlock(CRYPTO_LOCK_MALLOC2);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\tbreak;\n\tdefault:\n\t\tbreak;\n\t\t}\n\tCRYPTO_w_unlock(CRYPTO_LOCK_MALLOC);\n\treturn(ret);\n\t}', 'void CRYPTO_lock(int mode, int type, const char *file, int line)\n\t{\n#ifdef LOCK_DEBUG\n\t\t{\n\t\tCRYPTO_THREADID id;\n\t\tchar *rw_text,*operation_text;\n\t\tif (mode & CRYPTO_LOCK)\n\t\t\toperation_text="lock  ";\n\t\telse if (mode & CRYPTO_UNLOCK)\n\t\t\toperation_text="unlock";\n\t\telse\n\t\t\toperation_text="ERROR ";\n\t\tif (mode & CRYPTO_READ)\n\t\t\trw_text="r";\n\t\telse if (mode & CRYPTO_WRITE)\n\t\t\trw_text="w";\n\t\telse\n\t\t\trw_text="ERROR";\n\t\tCRYPTO_THREADID_current(&id);\n\t\tfprintf(stderr,"lock:%08lx:(%s)%s %-18s %s:%d\\n",\n\t\t\tCRYPTO_THREADID_hash(&id), rw_text, operation_text,\n\t\t\tCRYPTO_get_lock_name(type), file, line);\n\t\t}\n#endif\n\tif (type < 0)\n\t\t{\n\t\tif (dynlock_lock_callback != NULL)\n\t\t\t{\n\t\t\tstruct CRYPTO_dynlock_value *pointer\n\t\t\t\t= CRYPTO_get_dynlock_value(type);\n\t\t\tOPENSSL_assert(pointer != NULL);\n\t\t\tdynlock_lock_callback(mode, pointer, file, line);\n\t\t\tCRYPTO_destroy_dynlockid(type);\n\t\t\t}\n\t\t}\n\telse\n\t\tif (locking_callback != NULL)\n\t\t\tlocking_callback(mode,type,file,line);\n\t}', 'void *CRYPTO_malloc(int num, const char *file, int line)\n\t{\n\tvoid *ret = NULL;\n\tif (num <= 0) return NULL;\n\tallow_customize = 0;\n\tif (malloc_debug_func != NULL)\n\t\t{\n\t\tallow_customize_debug = 0;\n\t\tmalloc_debug_func(NULL, num, file, line, 0);\n\t\t}\n\tret = malloc_ex_func(num,file,line);\n#ifdef LEVITTE_DEBUG_MEM\n\tfprintf(stderr, "LEVITTE_DEBUG_MEM:         > 0x%p (%d)\\n", ret, num);\n#endif\n\tif (malloc_debug_func != NULL)\n\t\tmalloc_debug_func(ret, num, file, line, 1);\n#ifndef OPENSSL_CPUID_OBJ\n        if(ret && (num > 2048))\n\t{\textern unsigned char cleanse_ctr;\n                ((unsigned char *)ret)[0] = cleanse_ctr;\n\t}\n#endif\n\treturn ret;\n\t}']