libnfs: Fix segfault if O_TRUNC fails when creating
authorRoss Lagerwall <rosslagerwall@gmail.com>
Thu, 7 Aug 2014 19:45:08 +0000 (20:45 +0100)
committerRoss Lagerwall <rosslagerwall@gmail.com>
Thu, 7 Aug 2014 19:45:42 +0000 (20:45 +0100)
Signed-off-by: Ross Lagerwall <rosslagerwall@gmail.com>
lib/libnfs.c

index 5692dc3dac174cc3ea5c84e2f42f8b268a6723c4..87106bb0c6c7d0cb5dbaa6cecf7d9541f9f3dcdb 100644 (file)
@@ -2771,7 +2771,7 @@ static void nfs_create_trunc_cb(struct rpc_context *rpc, int status, void *comma
 {
        struct nfs_cb_data *data = private_data;
        struct nfs_context *nfs = data->nfs;
-       struct nfsfh *nfsfh;
+       struct nfsfh *nfsfh = data->nfsfh;
        SETATTR3res *res;
 
        assert(rpc->magic == RPC_CONTEXT_MAGIC);
@@ -2798,7 +2798,7 @@ static void nfs_create_trunc_cb(struct rpc_context *rpc, int status, void *comma
                return;
        }
 
-       data->cb(0, nfs, data->nfsfh, data->private_data);
+       data->cb(0, nfs, nfsfh, data->private_data);
        free_nfs_cb_data(data);
 }