Resolve possible error with uninitialized variable

This patch resolves a possible NULL pointer dereference in
merge-recursive/get_unmerged that can occur if either the ce_in_unmerged_list
condition or the memory allocation of calloc fails. By initializing e with NULL
and additional checks this possible error can be avoided.
Resolve realloc mistake and possible NP dereferences

This patches resolves the following issues in lib/utils/strsplit_by_space and in
lib/utils/strsplit_by_char:

  * Check if the pointer to the passed length parameter is valid otherwise
    it will cause a NULL pointer dereference

  * If the allocation done by realloc fails the current code would overwrite
    the pointer to the previously allocated memory with NULL, thus it is not
    reachable anymore. Therefore we need to store the return value of realloc
    in a temporary variable and then check it if the realloc call has succeeded
    or not. On failure we free the previously allocated memory and return an
    error.
Resolve pidfile resource leaks
Resolve common realloc mistake in lib/rsa.c

By replacing the realloc calls with g_realloc calls
we avoid losing previously allocated memory that would
be overwritten with the NULL failure return value of realloc.
Resolve out of bound access in lib/task.c
Resolve resource leak in test-seafile-fmt.c
Initialize new_commit with NULL in server/repo-op.c

This patch initializes the new_commit variable in the function
seaf_repo_manager_revert_on_server with NULL to avoid a possible misbehaviour
that could be caused if the uninitialized variable is accessed in the out block.
Resolve multiple errors in daemon/diff

This patch fixes multiple errors in daemon/diff.c by resolving the common
realloc mistake of nulling but not freeing the resource on failure. In addition
it gets rid of a possible error caused by the uninitialized variable pair. While
this patch resolves some issues it does not take care of proper error handling
if hash_char fails.