I had this error too at the weirdest places. It turned out I had some wrong initialized pointer and a missing allocation at a different place in the code.
Once I fixed this, the error was gone.
I guess in case of a pointer/address problem the message can say about everything, but th lsited function most likely is not the root of the problem.