Update memory.c

Implemented as discussed at Issue 30. The details can be found at: https://github.com/Openwsman/openwsman/issues/30