commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Xianda Ke (JIRA)" <>
Subject [jira] [Commented] (CRYPTO-89) more robust native code to eliminate memory leak
Date Thu, 23 Jun 2016 05:13:16 GMT


Xianda Ke commented on CRYPTO-89:

C doesn't support exceptions, try-finally blocks, or RAII at all. A typical approach is to
separate releasing of resources at the end of the function and jump there with gotos in the
case of error. This way the cleanup code need not be duplicated.

> more robust native code to eliminate memory leak
> ------------------------------------------------
>                 Key: CRYPTO-89
>                 URL:
>             Project: Commons Crypto
>          Issue Type: Bug
>            Reporter: Xianda Ke
>            Assignee: Xianda Ke
> currently, when handling error in the native code, some resource allocated is not deallocated.
> {code}
>     input_bytes = (unsigned char *) (*env)->GetByteArrayElements(env, input, 0); 
//in some case, it is not deallocated
> {code}
> the byte array may accupy lots of memory.  this can cause serious memory leak in the
long-running server

This message was sent by Atlassian JIRA

View raw message