func_periodic_hook: add module ref counting

This module lacked necessary module ref count incrementing and decrementing
when used.  This patch adds it.  There's already a datastore used, so doing the
ref counting along with the lifetime of the datastore provides a convenient
place to do it.



git-svn-id: http://svn.asterisk.org/svn/asterisk/trunk@412279 f38db490-d61c-443f-a65b-d21fe96a405b
func_periodic_hook: move module ref

The previous code left one error path where the module would be unref'd twice
instead of once.  It was done once in the error handling block, and again inside
of datastore destruction.

Now the module ref is only released in the datastore destructor and only acquired
when the datastore has been successfully allocated.



git-svn-id: http://svn.asterisk.org/svn/asterisk/trunk@412280 f38db490-d61c-443f-a65b-d21fe96a405b