ssl/t1_enc.c:360: error: MEMORY_LEAK
  memory dynamically allocated by call to `malloc()` at line 358, column 27 is not reachable after line 360, column 6.
Showing all 14 steps of the trace


ssl/t1_enc.c:333:1: start of procedure tls1_setup_key_block()
331.   	}
332.   
333. > int tls1_setup_key_block(SSL *s)
334.   	{
335.   	unsigned char *p1,*p2;

ssl/t1_enc.c:341:6: Taking false branch
339.   	SSL_COMP *comp;
340.   
341.   	if (s->s3->tmp.key_block_length != 0)
            ^
342.   		return(1);
343.   

ssl/t1_enc.c:344:7: Taking false branch
342.   		return(1);
343.   
344.   	if (!ssl_cipher_get_evp(s->session,&c,&hash,&comp))
             ^
345.   		{
346.   		SSLerr(SSL_F_TLS1_SETUP_KEY_BLOCK,SSL_R_CIPHER_OR_HASH_UNAVAILABLE);

ssl/t1_enc.c:350:2: 
348.   		}
349.   
350. > 	s->s3->tmp.new_sym_enc=c;
351.   	s->s3->tmp.new_hash=hash;
352.   

ssl/t1_enc.c:351:2: 
349.   
350.   	s->s3->tmp.new_sym_enc=c;
351. > 	s->s3->tmp.new_hash=hash;
352.   
353.   	num=EVP_CIPHER_key_length(c)+EVP_MD_size(hash)+EVP_CIPHER_iv_length(c);

ssl/t1_enc.c:353:2: 
351.   	s->s3->tmp.new_hash=hash;
352.   
353. > 	num=EVP_CIPHER_key_length(c)+EVP_MD_size(hash)+EVP_CIPHER_iv_length(c);
354.   	num*=2;
355.   

ssl/t1_enc.c:354:2: 
352.   
353.   	num=EVP_CIPHER_key_length(c)+EVP_MD_size(hash)+EVP_CIPHER_iv_length(c);
354. > 	num*=2;
355.   
356.   	ssl3_cleanup_key_block(s);

ssl/t1_enc.c:356:2: 
354.   	num*=2;
355.   
356. > 	ssl3_cleanup_key_block(s);
357.   
358.   	if ((p1=(unsigned char *)Malloc(num)) == NULL)

ssl/s3_enc.c:318:1: start of procedure ssl3_cleanup_key_block()
  316.   	}
  317.   
  318. > void ssl3_cleanup_key_block(SSL *s)
  319.   	{
  320.   	if (s->s3->tmp.key_block != NULL)

ssl/s3_enc.c:320:6: Taking false branch
  318.   void ssl3_cleanup_key_block(SSL *s)
  319.   	{
  320.   	if (s->s3->tmp.key_block != NULL)
              ^
  321.   		{
  322.   		memset(s->s3->tmp.key_block,0,

ssl/s3_enc.c:327:2: 
  325.   		s->s3->tmp.key_block=NULL;
  326.   		}
  327. > 	s->s3->tmp.key_block_length=0;
  328.   	}
  329.   

ssl/s3_enc.c:328:2: return from a call to ssl3_cleanup_key_block
  326.   		}
  327.   	s->s3->tmp.key_block_length=0;
  328.   	}
          ^
  329.   
  330.   int ssl3_enc(SSL *s, int send)

ssl/t1_enc.c:358:6: Taking false branch
356.   	ssl3_cleanup_key_block(s);
357.   
358.   	if ((p1=(unsigned char *)Malloc(num)) == NULL)
            ^
359.   		goto err;
360.   	if ((p2=(unsigned char *)Malloc(num)) == NULL)

ssl/t1_enc.c:360:6: Taking true branch
358.   	if ((p1=(unsigned char *)Malloc(num)) == NULL)
359.   		goto err;
360.   	if ((p2=(unsigned char *)Malloc(num)) == NULL)
            ^
361.   		goto err;
362.   

int tls1_setup_key_block(SSL *s)
	{
	unsigned char *p1,*p2;
	const EVP_CIPHER *c;
	const EVP_MD *hash;
	int num;
	SSL_COMP *comp;
	if (s->s3->tmp.key_block_length != 0)
		return(1);
	if (!ssl_cipher_get_evp(s->session,&c,&hash,&comp))
		{
		SSLerr(SSL_F_TLS1_SETUP_KEY_BLOCK,SSL_R_CIPHER_OR_HASH_UNAVAILABLE);
		return(0);
		}
	s->s3->tmp.new_sym_enc=c;
	s->s3->tmp.new_hash=hash;
	num=EVP_CIPHER_key_length(c)+EVP_MD_size(hash)+EVP_CIPHER_iv_length(c);
	num*=2;
	ssl3_cleanup_key_block(s);
	if ((p1=(unsigned char *)Malloc(num)) == NULL)
		goto err;
	if ((p2=(unsigned char *)Malloc(num)) == NULL)
		goto err;
	s->s3->tmp.key_block_length=num;
	s->s3->tmp.key_block=p1;
#ifdef TLS_DEBUG
printf("client random\n");
{ int z; for (z=0; z<SSL3_RANDOM_SIZE; z++) printf("%02X%c",s->s3->client_random[z],((z+1)%16)?' ':'\n'); }
printf("server random\n");
{ int z; for (z=0; z<SSL3_RANDOM_SIZE; z++) printf("%02X%c",s->s3->server_random[z],((z+1)%16)?' ':'\n'); }
printf("pre-master\n");
{ int z; for (z=0; z<s->session->master_key_length; z++) printf("%02X%c",s->session->master_key[z],((z+1)%16)?' ':'\n'); }
#endif
	tls1_generate_key_block(s,p1,p2,num);
	memset(p2,0,num);
	Free(p2);
#ifdef TLS_DEBUG
printf("\nkey block\n");
{ int z; for (z=0; z<num; z++) printf("%02X%c",p1[z],((z+1)%16)?' ':'\n'); }
#endif
	return(1);
err:
	SSLerr(SSL_F_TLS1_SETUP_KEY_BLOCK,ERR_R_MALLOC_FAILURE);
	return(0);
	}
['int tls1_setup_key_block(SSL *s)\n\t{\n\tunsigned char *p1,*p2;\n\tconst EVP_CIPHER *c;\n\tconst EVP_MD *hash;\n\tint num;\n\tSSL_COMP *comp;\n\tif (s->s3->tmp.key_block_length != 0)\n\t\treturn(1);\n\tif (!ssl_cipher_get_evp(s->session,&c,&hash,&comp))\n\t\t{\n\t\tSSLerr(SSL_F_TLS1_SETUP_KEY_BLOCK,SSL_R_CIPHER_OR_HASH_UNAVAILABLE);\n\t\treturn(0);\n\t\t}\n\ts->s3->tmp.new_sym_enc=c;\n\ts->s3->tmp.new_hash=hash;\n\tnum=EVP_CIPHER_key_length(c)+EVP_MD_size(hash)+EVP_CIPHER_iv_length(c);\n\tnum*=2;\n\tssl3_cleanup_key_block(s);\n\tif ((p1=(unsigned char *)Malloc(num)) == NULL)\n\t\tgoto err;\n\tif ((p2=(unsigned char *)Malloc(num)) == NULL)\n\t\tgoto err;\n\ts->s3->tmp.key_block_length=num;\n\ts->s3->tmp.key_block=p1;\n#ifdef TLS_DEBUG\nprintf("client random\\n");\n{ int z; for (z=0; z<SSL3_RANDOM_SIZE; z++) printf("%02X%c",s->s3->client_random[z],((z+1)%16)?\' \':\'\\n\'); }\nprintf("server random\\n");\n{ int z; for (z=0; z<SSL3_RANDOM_SIZE; z++) printf("%02X%c",s->s3->server_random[z],((z+1)%16)?\' \':\'\\n\'); }\nprintf("pre-master\\n");\n{ int z; for (z=0; z<s->session->master_key_length; z++) printf("%02X%c",s->session->master_key[z],((z+1)%16)?\' \':\'\\n\'); }\n#endif\n\ttls1_generate_key_block(s,p1,p2,num);\n\tmemset(p2,0,num);\n\tFree(p2);\n#ifdef TLS_DEBUG\nprintf("\\nkey block\\n");\n{ int z; for (z=0; z<num; z++) printf("%02X%c",p1[z],((z+1)%16)?\' \':\'\\n\'); }\n#endif\n\treturn(1);\nerr:\n\tSSLerr(SSL_F_TLS1_SETUP_KEY_BLOCK,ERR_R_MALLOC_FAILURE);\n\treturn(0);\n\t}', 'void ssl3_cleanup_key_block(SSL *s)\n\t{\n\tif (s->s3->tmp.key_block != NULL)\n\t\t{\n\t\tmemset(s->s3->tmp.key_block,0,\n\t\t\ts->s3->tmp.key_block_length);\n\t\tFree(s->s3->tmp.key_block);\n\t\ts->s3->tmp.key_block=NULL;\n\t\t}\n\ts->s3->tmp.key_block_length=0;\n\t}']