rem: free(ptr);
add: wfree(ptr);
context: WMReplaceInBag(WMBag *self, int index, void *item){    W_Node *ptr = treeSearch(self->root, self->nil, index);    void *old = NULL;    if (item == NULL) {        self->count--;        ptr = rbTreeDelete(self, ptr);        if (self->destructor)            self->destructor(ptr->data);        free(ptr);    } else if (ptr != self->nil) {        old = ptr->data;        ptr->data = item;    } else {        W_Node *ptr;        ptr = wmalloc(sizeof(W_Node));        ptr->data = item;        ptr->index = index;        ptr->left = self->nil;        ptr->right = self->nil;        ptr->parent = self->nil;        rbTreeInsert(self, ptr);        self->count++;    }    return old;}