From 14d2b30c2c884395f9e093ca49b488d45ba68bb2 Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Mon, 15 Aug 2011 11:35:23 -0400 Subject: [PATCH] callback: avoid malloc in nfs41_callback_session_init() Signed-off-by: Casey Bodley --- daemon/callback_server.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/daemon/callback_server.c b/daemon/callback_server.c index f2cad6e..a49ad45 100644 --- a/daemon/callback_server.c +++ b/daemon/callback_server.c @@ -48,23 +48,15 @@ static void replay_cache_write( void nfs41_callback_session_init( IN nfs41_session *session) { - struct cb_compound_res *res; + /* initialize the replay cache with status NFS4ERR_SEQ_MISORDERED */ + struct cb_compound_res res; + StringCchCopyA(res.tag.str, CB_COMPOUND_MAX_TAG, g_server_tag); + res.tag.len = sizeof(g_server_tag); + res.status = NFS4ERR_SEQ_MISORDERED; session->cb_session.cb_sessionid = session->session_id; - /* initialize the replay cache with status NFS4ERR_SEQ_MISORDERED */ - res = calloc(1, sizeof(struct cb_compound_res)); - if (res == NULL) { - /* don't need to return failure, just leave cb_replay_cached=0 */ - return; - } - - StringCchCopyA(res->tag.str, CB_COMPOUND_MAX_TAG, g_server_tag); - res->tag.len = sizeof(g_server_tag); - res->status = NFS4ERR_SEQ_MISORDERED; - - replay_cache_write(&session->cb_session, NULL, res, FALSE); - free(res); + replay_cache_write(&session->cb_session, NULL, &res, FALSE); }