Next: , Previous: , Up: Exchanging Data   [Contents][Index]

6.2 Destroying Data Buffers

Function: void gpgme_data_release (gpgme_data_t dh)

The function gpgme_data_release destroys the data object with the handle dh. It releases all associated resources that were not provided by the user in the first place.

Function: char * gpgme_data_release_and_get_mem (gpgme_data_t dh, size_t *length)

The function gpgme_data_release_and_get_mem is like gpgme_data_release, except that it returns the data buffer and its length that was provided by the object.

The user has to release the buffer with gpgme_free. In case the user provided the data buffer in non-copy mode, a copy will be made for this purpose.

In case an error returns, or there is no suitable data buffer that can be returned to the user, the function will return NULL. In any case, the data object dh is destroyed.

Function: void gpgme_free (void *buffer)

SINCE: 1.1.1

The function gpgme_free releases the memory returned by gpgme_data_release_and_get_mem and gpgme_pubkey_algo_string. It should be used instead of the system libraries free function in case different allocators are used by a program. This is often the case if gpgme is used under Windows as a DLL.