if (cdbfr != NULL) {
dellist = malloc(cdbfr->len);
- msglist = (long *) cdbfr->ptr;
- cdbfr->ptr = NULL; // CtdlDeleteMessages() now owns this memory (this needs attention if we move to LMDB)
num_msgs = cdbfr->len / sizeof(long);
+ msglist = (long *) malloc(cdbfr->len);
+ memcpy(msglist, cdbfr->ptr, cdbfr->len);
cdb_free(cdbfr);
}
if (num_msgs > 0) {