}
PUSHMARK (SP);
XPUSHs (sv_2mortal (newSViv (PTR2IV (task))));
- XPUSHs (AvARRAY (av));
+ XPUSHs (sv_2mortal ((SV *)AvARRAY (av)));
PUTBACK;
call_pv (function, G_SCALAR);
call_sv (callback_data->callback, G_SCALAR);
- free (callback_data);
- free (ctx);
/* Set save point */
callback_data->task->save.saved = 0;
process_filters (callback_data->task);
#include "../config.h"
#include "../main.h"
#include "../perl.h"
+#include "../mem_pool.h"
#define perl_set_session(r) \
r = INT2PTR(struct worker_task *, SvIV((SV *) SvRV(ST(0))))
callback = SvRV(ST(3));
/* Copy old ctx to new one */
- ctx = malloc (sizeof (memcached_ctx_t));
+ ctx = memory_pool_alloc (r->task_pool, sizeof (memcached_ctx_t));
if (ctx == NULL) {
XSRETURN_UNDEF;
}
memcpy (ctx, r->memc_ctx, sizeof (memcached_ctx_t));
/* Set perl callback */
ctx->callback = perl_call_memcached_callback;
- callback_data = malloc (sizeof (struct _param));
+ callback_data = memory_pool_alloc (r->task_pool, sizeof (struct _param));
if (callback_data == NULL) {
XSRETURN_UNDEF;
}
ctx->callback_data = (void *)callback_data;
strlcpy (param.key, key, sizeof (param.key));
- param.buf = malloc (datalen);
+ param.buf = memory_pool_alloc (r->task_pool, datalen);
if (param.buf != NULL) {
param.bufsize = datalen;
}
callback = SvRV(ST(4));
/* Copy old ctx to new one */
- ctx = malloc (sizeof (memcached_ctx_t));
+ ctx = memory_pool_alloc (r->task_pool, sizeof (memcached_ctx_t));
if (ctx == NULL) {
XSRETURN_UNDEF;
}
memcpy (ctx, r->memc_ctx, sizeof (memcached_ctx_t));
/* Set perl callback */
ctx->callback = perl_call_memcached_callback;
- callback_data = malloc (sizeof (struct _param));
+ callback_data = memory_pool_alloc (r->task_pool, sizeof (struct _param));
if (callback_data == NULL) {
XSRETURN_UNDEF;
}
callback = SvRV(ST(2));
/* Copy old ctx to new one */
- ctx = malloc (sizeof (memcached_ctx_t));
+ ctx = memory_pool_alloc (r->task_pool, sizeof (memcached_ctx_t));
if (ctx == NULL) {
XSRETURN_UNDEF;
}
memcpy (ctx, r->memc_ctx, sizeof (memcached_ctx_t));
/* Set perl callback */
ctx->callback = perl_call_memcached_callback;
- callback_data = malloc (sizeof (struct _param));
+ callback_data = memory_pool_alloc (r->task_pool, sizeof (struct _param));
if (callback_data == NULL) {
XSRETURN_UNDEF;
}