you have assigned new memory to "ptr" on line 10 pointer but u didn't free it up before new allocation
delete on line 16 will free up ptr only for second alloc. on line 10 but not for alloc on line 7.
alloc on line 7 is lost.
There're some typos (line 4 / 13). Line 13 I guess you want x = 0? Then you delete the first pointer but remove the last. It'd be better to use 'mydeque.front()' and 'mydeque.pop_front()' in order to avoid confusion like so: