Instead of doing memset(), you can initialize apndb in the definition as follows:

struct apndb_data apndb = {NULL};

which would set all fields to 0.