本文整理汇总了C++中MEM_FREE函数的典型用法代码示例。如果您正苦于以下问题:C++ MEM_FREE函数的具体用法?C++ MEM_FREE怎么用?C++ MEM_FREE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MEM_FREE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: valid
static int valid(char *ciphertext, struct fmt_main *self)
{
char *ptr, *ctcopy, *keeptr;
if (strncmp(ciphertext, "$episerver$*", 12))
return 0;
if (!(ctcopy = strdup(ciphertext)))
return 0;
keeptr = ctcopy;
ctcopy += 12; /* skip leading '$episerver$*' */
if (strlen(ciphertext) > 255)
goto error;
if (!(ptr = strtokm(ctcopy, "*")))
goto error;
/* check version, must be '0' or '1' */
if (*ptr != '0' && *ptr != '1')
goto error;
if (!(ptr = strtokm(NULL, "*"))) /* salt */
goto error;
if (strlen(ptr) > 24)
goto error;
if (!(ptr = strtokm(NULL, "*"))) /* hash */
goto error;
if (strlen(ptr) > 44)
goto error;
if ((ptr = strtokm(NULL, "*"))) /* end */
goto error;
MEM_FREE(keeptr);
return 1;
error:
MEM_FREE(keeptr);
return 0;
}
示例2: freeFonts
/* Free font record */
static void freeFonts(tcCtx g) {
tcprivCtx h = g->ctx.tcpriv;
int i;
/* Free font data */
for (i = 0; i < h->set.cnt; i++) {
Font *font = &h->set.array[i];
MEM_FREE(g, font->FontName);
dnaFREE(font->dict);
dnaFREE(font->Private);
csFreeFont(g, font);
if (font->flags & FONT_CID) {
int fdCount = font->fdCount;
int fd;
if (font->fdInfo) {
for (fd = 0; fd < fdCount; fd++) {
dnaFREE(font->fdInfo[fd].FD);
dnaFREE(font->fdInfo[fd].Private);
}
MEM_FREE(g, font->fdInfo);
}
MEM_FREE(g, font->fdIndex);
}
MEM_FREE(g, font->chameleon.data);
(void)fontInit(g, 1, font); /* Prepare to reuse */
}
h->set.cnt = 0;
}
示例3: done
static void done(void)
{
/* FIXME: How do we de-init cuda stuff? */
MEM_FREE(ghash);
MEM_FREE(g_ext_key);
MEM_FREE(gkey);
}
示例4: int
/*
* sets the current section
*/
int (conf_section)(const char *sec)
{
size_t len;
char buf[30], *pbuf;
const char *hkey;
table_t *tab;
assert(sec);
/* sepunit() always clears errcode */
len = strlen(sec);
pbuf = strcpy((len > sizeof(buf)-1)? MEM_ALLOC(len+1): buf, sec);
if (sepunit(pbuf, &pbuf) != CONF_ERR_OK) {
if (pbuf != buf)
MEM_FREE(pbuf);
return errcode; /* sepunit sets errcode */
}
hkey = hash_string((control & CONF_OPT_CASE)? pbuf: lower(pbuf));
if (pbuf != buf)
MEM_FREE(pbuf);
tab = table_get(section, hkey);
if (tab)
current = tab;
else
errcode = CONF_ERR_SEC;
return errcode;
}
示例5: ensure_allocated
/*******************************************************************************
*
* Helper functions.
*
******************************************************************************/
static enum sl_error
ensure_allocated(struct sl_vector* vec, size_t capacity, bool keep_data)
{
void* buffer = NULL;
enum sl_error sl_err = SL_NO_ERROR;
ASSERT(vec);
if(capacity > vec->capacity) {
size_t new_capacity = 0;
NEXT_POWER_OF_2(capacity, new_capacity);
buffer = MEM_ALIGNED_ALLOC
(vec->allocator, new_capacity * vec->data_size, vec->data_alignment);
if(!buffer) {
sl_err = SL_MEMORY_ERROR;
goto error;
}
if(keep_data) {
buffer = memcpy(buffer, vec->buffer, vec->capacity * vec->data_size);
}
MEM_FREE(vec->allocator, vec->buffer);
vec->buffer = buffer;
vec->capacity = new_capacity;
buffer = NULL;
}
exit:
return sl_err;
error:
if(buffer) {
MEM_FREE(vec->allocator, buffer);
buffer = NULL;
}
goto exit;
}
示例6: valid
static int valid(char *ciphertext, struct fmt_main *self)
{
char *ctcopy, *keeptr, *p;
if (strncmp(ciphertext, "$keychain$*", 11) != 0)
return 0;
ctcopy = strdup(ciphertext);
keeptr = ctcopy;
ctcopy += 11;
if ((p = strtokm(ctcopy, "*")) == NULL) /* salt */
goto err;
if(strlen(p) != SALTLEN * 2)
goto err;
if ((p = strtokm(NULL, "*")) == NULL) /* iv */
goto err;
if(strlen(p) != IVLEN * 2)
goto err;
if ((p = strtokm(NULL, "*")) == NULL) /* ciphertext */
goto err;
if(strlen(p) != CTLEN * 2)
goto err;
MEM_FREE(keeptr);
return 1;
err:
MEM_FREE(keeptr);
return 0;
}
示例7: release_clobj
static void release_clobj(void)
{
HANDLE_CLERROR(clReleaseMemObject(mem_in), "Release mem in");
HANDLE_CLERROR(clReleaseMemObject(mem_out), "Release mem out");
MEM_FREE(ghash);
MEM_FREE(gkey);
}
示例8: wav_free
void wav_free(RawSound* sound) {
assert(sound);
assert(sound->data);
MEM_FREE(sound->data);
sound->data = NULL;
MEM_FREE(sound);
}
示例9: done
static void done(void)
{
int i;
for (i = 0; i < 8; i++)
MEM_FREE(crypt_key[i]);
MEM_FREE(saved_key);
}
示例10: done
static void done(void)
{
MEM_FREE(crypt_out);
MEM_FREE(saved_key);
#ifndef SIMD_COEF_64
MEM_FREE(saved_len);
#endif
}
示例11: done
static void done(void)
{
MEM_FREE(crypt_key);
MEM_FREE(saved_key);
#ifdef SIMD_COEF_32
MEM_FREE(saved_len);
#endif
}
示例12: SQLReadFileDSNW
BOOL INSTAPI
SQLReadFileDSNW (LPCWSTR lpszFileName, LPCWSTR lpszAppName,
LPCWSTR lpszKeyName, LPWSTR lpszString, WORD cbString, WORD * pcbString)
{
char *_filename_u8 = NULL;
char *_appname_u8 = NULL;
char *_keyname_u8 = NULL;
char *_string_u8 = NULL;
BOOL retcode = FALSE;
_filename_u8 = (char *) dm_SQL_WtoU8 ((SQLWCHAR *) lpszFileName, SQL_NTS);
if (_filename_u8 == NULL && lpszFileName)
{
PUSH_ERROR (ODBC_ERROR_OUT_OF_MEM);
goto done;
}
_appname_u8 = (char *) dm_SQL_WtoU8 ((SQLWCHAR *) lpszAppName, SQL_NTS);
if (_appname_u8 == NULL && lpszAppName)
{
PUSH_ERROR (ODBC_ERROR_OUT_OF_MEM);
goto done;
}
_keyname_u8 = (char *) dm_SQL_WtoU8 ((SQLWCHAR *) lpszKeyName, SQL_NTS);
if (_keyname_u8 == NULL && lpszKeyName)
{
PUSH_ERROR (ODBC_ERROR_OUT_OF_MEM);
goto done;
}
if (cbString > 0)
{
if ((_string_u8 = malloc (cbString * UTF8_MAX_CHAR_LEN + 1)) == NULL)
{
PUSH_ERROR (ODBC_ERROR_OUT_OF_MEM);
goto done;
}
}
retcode =
SQLReadFileDSN (_filename_u8, _appname_u8, _keyname_u8, _string_u8,
cbString * UTF8_MAX_CHAR_LEN, pcbString);
if (retcode == TRUE)
{
dm_StrCopyOut2_U8toW (_string_u8, lpszString, cbString, pcbString);
}
done:
MEM_FREE (_filename_u8);
MEM_FREE (_appname_u8);
MEM_FREE (_keyname_u8);
MEM_FREE (_string_u8);
return retcode;
}
示例13: find_best_workgroup
static void find_best_workgroup(int jtrUniqDevNo) {
size_t _lws=0;
cl_device_type dTyp;
cl_command_queue cmdq;
cl_int err;
cl_uint *dcc_hash_host
= (cl_uint*)mem_alloc(4 * sizeof(cl_uint) * ((MAX_KEYS_PER_CRYPT < 65536) ? MAX_KEYS_PER_CRYPT : 65536));
cl_uint *dcc2_hash_host
= (cl_uint*)mem_alloc(4 * sizeof(cl_uint) * ((MAX_KEYS_PER_CRYPT < 65536) ? MAX_KEYS_PER_CRYPT : 65536));
cl_uint salt_api[9], length = 10;
event_ctr = 0;
//HANDLE_CLERROR(clGetDeviceInfo(devices[jtrUniqDevNo], CL_DEVICE_TYPE, sizeof(cl_device_type), &dTyp, NULL), "Failed Device Info");
dTyp = get_device_type(jtrUniqDevNo);
if (dTyp == CL_DEVICE_TYPE_CPU)
globalObj[jtrUniqDevNo].lws = 1;
else
globalObj[jtrUniqDevNo].lws = 16;
///Set Dummy DCC hash , unicode salt and ascii salt(username) length
memset(dcc_hash_host, 0xb5, 4 * sizeof(cl_uint) * ((MAX_KEYS_PER_CRYPT < 65536) ? MAX_KEYS_PER_CRYPT : 65536));
memset(salt_api, 0xfe, 9 * sizeof(cl_uint));
cmdq = clCreateCommandQueue(context[jtrUniqDevNo], devices[jtrUniqDevNo], CL_QUEUE_PROFILING_ENABLE, &err);
HANDLE_CLERROR(err, "Error creating command queue");
PROFILE = 1;
kernelExecTimeNs = CL_ULONG_MAX;
///Find best local work size
while (1) {
_lws = globalObj[jtrUniqDevNo].lws;
if (dTyp == CL_DEVICE_TYPE_CPU) {
exec_pbkdf2(dcc_hash_host, salt_api, length, dcc2_hash_host, 4096, jtrUniqDevNo, cmdq);
globalObj[jtrUniqDevNo].exec_time_inv = globalObj[jtrUniqDevNo].exec_time_inv / 16;
}
else {
exec_pbkdf2(dcc_hash_host, salt_api, length, dcc2_hash_host, ((MAX_KEYS_PER_CRYPT < 65536) ? MAX_KEYS_PER_CRYPT : 65536), jtrUniqDevNo, cmdq);
globalObj[jtrUniqDevNo].exec_time_inv *= ((MAX_KEYS_PER_CRYPT < 65536) ? MAX_KEYS_PER_CRYPT : 65536) / 65536;
}
if (globalObj[jtrUniqDevNo].lws <= _lws) break;
}
PROFILE = 0;
if (options.verbosity > 2) {
fprintf(stderr, "Optimal Work Group Size:%d\n", (int)globalObj[jtrUniqDevNo].lws);
fprintf(stderr, "Kernel Execution Speed (Higher is better):%Lf\n", globalObj[jtrUniqDevNo].exec_time_inv);
}
MEM_FREE(dcc_hash_host);
MEM_FREE(dcc2_hash_host);
HANDLE_CLERROR(clReleaseCommandQueue(cmdq), "Release Command Queue:Failed");
}
示例14: release_clobj
static void release_clobj(void)
{
HANDLE_CLERROR(clReleaseMemObject(mem_in), "Release mem in");
HANDLE_CLERROR(clReleaseMemObject(mem_setting), "Release mem setting");
HANDLE_CLERROR(clReleaseMemObject(mem_out), "Release mem out");
MEM_FREE(inbuffer);
MEM_FREE(outbuffer);
MEM_FREE(cracked);
}
示例15: done
static void done(void)
{
int i;
for (i = 0; i < max_threads; i++)
escrypt_free_local(&local[i]);
MEM_FREE(local);
MEM_FREE(buffer);
}