This is because in C, you cannot reassign the memory address of the pointer because it is passed by value.
If you really want to do this, you must pass the address of the pointer into the build function.
See: Passing pointer argument by reference under C?