[RFC] Add missing function attributes to functions in memory.h #806

Hi, 

This fixes issue #806. Any feedback or suggestions would  be greatly appreciated. 

Thanks!
@philix as seen in the docs: https://gcc.gnu.org/onlinedocs/gcc-4.9.0/gcc/Function-Attributes.html#nonnull, this only applies to pointer arguments.