#define C_INITIALIZED 0x01 /**< cursor has been initialized and is valid */
#define C_EOF 0x02 /**< No more data */
#define C_SUB 0x04 /**< Cursor is a sub-cursor */
-#define C_SHADOW 0x08 /**< Cursor is a dup from a parent txn */
+#define C_SHADOW 0x08 /**< Cursor is a dup from a parent txn */
+#define C_ALLOCD 0x10 /**< Cursor was malloc'd */
/** @} */
unsigned int mc_flags; /**< @ref mdb_cursor */
MDB_page *mc_pg[CURSOR_STACK]; /**< stack of pushed pages */
m2->mc_ki[j] = mc->mc_ki[j];
}
}
- free(mc);
+ if (mc->mc_flags & C_ALLOCD)
+ free(mc);
}
}
}
MDB_cursor *mc;
while ((mc = txn->mt_cursors[i])) {
txn->mt_cursors[i] = mc->mc_next;
- free(mc);
+ if (mc->mc_flags & C_ALLOCD)
+ free(mc);
}
}
}
mc->mc_next = txn->mt_cursors[dbi];
txn->mt_cursors[dbi] = mc;
}
+ mc->mc_flags |= C_ALLOCD;
} else {
return ENOMEM;
}
if (*prev == mc)
*prev = mc->mc_next;
}
- free(mc);
+ if (mc->mc_flags & C_ALLOCD)
+ free(mc);
}
}