Improved memory allocation.

Using sizeof(variable_name) instead of sizeof(type_name).