mirror of
				https://github.com/cuberite/polarssl.git
				synced 2025-11-04 04:32:24 -05:00 
			
		
		
		
	Make malloc-init script a bit happier
This commit is contained in:
		
							parent
							
								
									5924f9f810
								
							
						
					
					
						commit
						e5b0fc1847
					
				@ -327,6 +327,8 @@ asn1_named_data *asn1_store_named_data( asn1_named_data **head,
 | 
				
			|||||||
            return( NULL );
 | 
					            return( NULL );
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        memcpy( cur->oid.p, oid, oid_len );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        cur->val.len = val_len;
 | 
					        cur->val.len = val_len;
 | 
				
			||||||
        cur->val.p = polarssl_malloc( val_len );
 | 
					        cur->val.p = polarssl_malloc( val_len );
 | 
				
			||||||
        if( cur->val.p == NULL )
 | 
					        if( cur->val.p == NULL )
 | 
				
			||||||
@ -336,8 +338,6 @@ asn1_named_data *asn1_store_named_data( asn1_named_data **head,
 | 
				
			|||||||
            return( NULL );
 | 
					            return( NULL );
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        memcpy( cur->oid.p, oid, oid_len );
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        cur->next = *head;
 | 
					        cur->next = *head;
 | 
				
			||||||
        *head = cur;
 | 
					        *head = cur;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -105,10 +105,8 @@ int ssl_cache_get( void *data, ssl_session *session )
 | 
				
			|||||||
         */
 | 
					         */
 | 
				
			||||||
        if( entry->peer_cert.p != NULL )
 | 
					        if( entry->peer_cert.p != NULL )
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            session->peer_cert =
 | 
					            if( ( session->peer_cert = (x509_crt *) polarssl_malloc(
 | 
				
			||||||
                (x509_crt *) polarssl_malloc( sizeof(x509_crt) );
 | 
					                                 sizeof(x509_crt) ) ) == NULL )
 | 
				
			||||||
 | 
					 | 
				
			||||||
            if( session->peer_cert == NULL )
 | 
					 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                ret = 1;
 | 
					                ret = 1;
 | 
				
			||||||
                goto exit;
 | 
					                goto exit;
 | 
				
			||||||
@ -226,8 +224,7 @@ int ssl_cache_set( void *data, const ssl_session *session )
 | 
				
			|||||||
            /*
 | 
					            /*
 | 
				
			||||||
             * max_entries not reached, create new entry
 | 
					             * max_entries not reached, create new entry
 | 
				
			||||||
             */
 | 
					             */
 | 
				
			||||||
            cur = (ssl_cache_entry *)
 | 
					            cur = (ssl_cache_entry *) polarssl_malloc( sizeof(ssl_cache_entry) );
 | 
				
			||||||
                        polarssl_malloc( sizeof(ssl_cache_entry) );
 | 
					 | 
				
			||||||
            if( cur == NULL )
 | 
					            if( cur == NULL )
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                ret = 1;
 | 
					                ret = 1;
 | 
				
			||||||
@ -264,8 +261,8 @@ int ssl_cache_set( void *data, const ssl_session *session )
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    if( session->peer_cert != NULL )
 | 
					    if( session->peer_cert != NULL )
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        cur->peer_cert.p = (unsigned char *)
 | 
					        cur->peer_cert.p = (unsigned char *) polarssl_malloc(
 | 
				
			||||||
                                polarssl_malloc( session->peer_cert->raw.len );
 | 
					                            session->peer_cert->raw.len );
 | 
				
			||||||
        if( cur->peer_cert.p == NULL )
 | 
					        if( cur->peer_cert.p == NULL )
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            ret = 1;
 | 
					            ret = 1;
 | 
				
			||||||
 | 
				
			|||||||
@ -3341,14 +3341,14 @@ static int ssl_handshake_init( ssl_context *ssl )
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    if( ssl->transform_negotiate == NULL )
 | 
					    if( ssl->transform_negotiate == NULL )
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        ssl->transform_negotiate =
 | 
					        ssl->transform_negotiate = (ssl_transform *) polarssl_malloc(
 | 
				
			||||||
            (ssl_transform *) polarssl_malloc( sizeof(ssl_transform) );
 | 
					                             sizeof(ssl_transform) );
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if( ssl->session_negotiate == NULL )
 | 
					    if( ssl->session_negotiate == NULL )
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        ssl->session_negotiate =
 | 
					        ssl->session_negotiate = (ssl_session *) polarssl_malloc(
 | 
				
			||||||
            (ssl_session *) polarssl_malloc( sizeof(ssl_session) );
 | 
					                           sizeof(ssl_session) );
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if( ssl->handshake == NULL )
 | 
					    if( ssl->handshake == NULL )
 | 
				
			||||||
 | 
				
			|||||||
@ -243,8 +243,8 @@ static int x509_get_entries( unsigned char **p,
 | 
				
			|||||||
            if( cur_entry->next == NULL )
 | 
					            if( cur_entry->next == NULL )
 | 
				
			||||||
                return( POLARSSL_ERR_X509_MALLOC_FAILED );
 | 
					                return( POLARSSL_ERR_X509_MALLOC_FAILED );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            memset( cur_entry->next, 0, sizeof( x509_crl_entry ) );
 | 
				
			||||||
            cur_entry = cur_entry->next;
 | 
					            cur_entry = cur_entry->next;
 | 
				
			||||||
            memset( cur_entry, 0, sizeof( x509_crl_entry ) );
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -294,8 +294,8 @@ int x509_crl_parse( x509_crl *chain, const unsigned char *buf, size_t buflen )
 | 
				
			|||||||
            return( POLARSSL_ERR_X509_MALLOC_FAILED );
 | 
					            return( POLARSSL_ERR_X509_MALLOC_FAILED );
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        x509_crl_init( crl->next );
 | 
				
			||||||
        crl = crl->next;
 | 
					        crl = crl->next;
 | 
				
			||||||
        x509_crl_init( crl );
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined(POLARSSL_PEM_PARSE_C)
 | 
					#if defined(POLARSSL_PEM_PARSE_C)
 | 
				
			||||||
@ -532,8 +532,8 @@ int x509_crl_parse( x509_crl *chain, const unsigned char *buf, size_t buflen )
 | 
				
			|||||||
            return( POLARSSL_ERR_X509_MALLOC_FAILED );
 | 
					            return( POLARSSL_ERR_X509_MALLOC_FAILED );
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        x509_crl_init( crl->next );
 | 
				
			||||||
        crl = crl->next;
 | 
					        crl = crl->next;
 | 
				
			||||||
        x509_crl_init( crl );
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return( x509_crl_parse( crl, buf, buflen ) );
 | 
					        return( x509_crl_parse( crl, buf, buflen ) );
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -819,8 +819,8 @@ int x509_crt_parse_der( x509_crt *chain, const unsigned char *buf,
 | 
				
			|||||||
            return( POLARSSL_ERR_X509_MALLOC_FAILED );
 | 
					            return( POLARSSL_ERR_X509_MALLOC_FAILED );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        prev = crt;
 | 
					        prev = crt;
 | 
				
			||||||
 | 
					        x509_crt_init( crt->next );
 | 
				
			||||||
        crt = crt->next;
 | 
					        crt = crt->next;
 | 
				
			||||||
        x509_crt_init( crt );
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if( ( ret = x509_crt_parse_der_core( crt, buf, buflen ) ) != 0 )
 | 
					    if( ( ret = x509_crt_parse_der_core( crt, buf, buflen ) ) != 0 )
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user