Avoid dereference a NULL pointer

This call chain might dereference NULL:
path_storage -> copy_from -> add_vertex -> storage_ptr -> allocate_block
-> memcpy

Reported by coverity
Merge branch 'atronix' into coverity_scan