Coding style fix: strncpy --> strlcpy.
free and unmock when done.
Adding counter variables to keep track of how many times mock functions were called. Adding basic input sanity checks to some mock functions.