Fix memory leak on diff error

* src/git2r_diff.c: Wait to call Rf_error before all allocated
  resources are freed. Changed git2r_diff_format_to_r return error
  code on failure. S4 class git_diff are created before calling
  git2r_diff_format_to_r.
Fix Note from R CMD check

* checking compiled code ... NOTE
File ‘/home/stefan/projects/packages/git2r/git2r.Rcheck/git2r/libs/git2r.so’:
  Found ‘stdout’, possibly from ‘stdout’ (C)
    Object: ‘libgit2/diff_print.o’

Compiled code should not call entry points which might terminate R nor
write to stdout/stderr instead of to the console.

* src/libgit2/diff_print.c (git_diff_print_callback__to_file_handle):
  Return error code (-1) instead of using 'stdout' if FILE pointer is
  NULL.
Add diff print functionality

* Generate formated text output from diff. Added argument filename to
  the diff method to determine how to process the result from the
  diff.

* R/diff.r (diff): Add argument 'filename' to determine where to write
  the diff. If filename is NULL (the default), then the diff is
  written to a S4 class git_diff object. If filename equals
  character(0) or NA_character_, then the diff is written to a
  character vector. If filename is a character vector of length one
  with non-NA value, the diff is written to a file with name
  filename (the file is overwritten if it exists). The retrun value
  from the method is a git_diff object if filename equals NULL. A
  character vector if filename equals character(0) or
  NA_character_. Oterwise NULL.

* src/git2r_diff.c/h: Add functionality to write the diff to a file or
  a character vector determined by the filename argument.

* src/git2r_arg.c/h (git2r_arg_check_filename): Add function to check
  the filename argument to diff functions.

* src/git2r_error.c/h: Add error message for invalid filename argument
* man/diff-methods.Rd: Rebuild

* src/git2r.c: Update callMethods