In C:

    if ( data != NULL  &&  flags & ERR_TXT_STRING ) {

      PRINT(data);

      if ( flags & ERR_TXT_MALLOCED ) {
        OPENSSL_free((void *)data);
      }
    }

> From: Adam M [mailto:open...@irotas.net]
> Sent: Tuesday, January 28, 2014 5:47 PM
> To: openssl-users@openssl.org
> 
> I'm reading the documentation for ERR_get_error_line_data() here:
> http://www.openssl.org/docs/crypto/ERR_get_error.html
> 
> The comments say that 'data' is dynamically allocated with
> OPENSSL_malloc() if the ERR_TXT_MALLOCED bit is set in 'flags'. I
> presume this means that we need to call OPENSSL_free() to free 'data',
> but the documentation isn't clear on that.
> 
> I'm running into two issues in this regard. For one, 'data' is a 'const
> char*', but OPENSSL_free() takes a 'void*', so we get a type mismatch.
> See my sample code here, which includes the compiler error message:
> http://pastebin.com/VNdkwf0G
> 
> The second issue is that I've been looking around on the web (in
> particular on Ohloh) for usage of ERR_get_error_line_data(), and no one
> seems to be checking for the ERR_TXT_MALLOCED bit in 'flags'. Maybe
> doing so isn't necessary, but the documentation seems to suggest that
> it
> is.
> 
> Can someone please help clarify what exactly to do here?
> 
> Thanks,
> Adam
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to