libnfs.h: wrap in extern "C" for C++ compatibility

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
libnfs-raw.h: rename export -> exportname to avoid clash with C++ keyword

From http://en.cppreference.com/w/cpp/keyword/export :

  Until C++11:
  "Used to mark a template definition exported, which allows the same
   template to be declared, but not defined, in other translation units."

  Since C++11:
  "The keyword is unused and reserved."

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
nfs_opendir_cb: plug potential memory leak

Spotted by clang analyzer.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
nfs_lookuppath_async: plug potential memleak

Spotted by clang analyzer.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
nfs_mknod_async: plug potential memory leak

Pointed out by clang analyzer.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
nfs_creat_async: plug potential memleak

Spotted by clang analyzer.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
nfs_fchown_async: plug potential memleak

Spotted by clang analyzer.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
nfs_fchown_async: fix nullptr dereference

nfs_chown_data is hooked up under nfs_cb_data->continue_data but
no ->free_continue_data is configured, so once free_nfs_cb_data is
invoked it will trip over a nullptr.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
free_nfs_cb_data: add assert(data->free_continue_data)

Non-debug builds will trip over the nullptr too - do we rather
want to leak the memory there?

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
free_nfs_cb_data: make static and drop superfluous nullptr checks / assignments

free() can cope with nullptrs and there's no point in null-ing free'd members
as the containing struct is free'd as well.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
nfs_opendir2_cb: plug potential memleaks

Spotted by clang analyzer

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
nfs_fchmod_async: fix use-after-free

Spotted by clang analyzer

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
nfs_fchown_async: fix use-after-free

Spotted by clang analyzer.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
nfs_mknod_async: fix use-after-free

Spotted by clang analyzer

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
nfs_mkdir_async: fix potential memory leak

Pointed out by clang analyzer

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
nfs_rmdir_async: fix potential memory leak

Spotted by clang analyzer.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
nfs_unlink_async: plug potential memory leak

Spotted by clang analyzer

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
nfs_rename_continue_1_internal: fix use-after-free

Spotted by clang analyzer.
This introduces another allocation to create a copy of the target path
of a rename in case it needs to be reported via rpc_set_error - it might
be a better idea to avoid the allocation and have a slightly less informative
error message?

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
{nfs,rpc}_set_error: add __attribute__((format(printf))) annotations

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
socket.c: fix format string issues (too few arguments)

These were uncovered by the previously added __attribute__((format(printf))).

Emacs also removed trailing whitespace while at it.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>