packet-nfs: do not call g_hash_table_remove before g_hash_table_insert
authorTigran Mkrtchyan <tigran.mkrtchyan@desy.de>
Wed, 24 Feb 2016 07:59:07 +0000 (08:59 +0100)
committerPeter Wu <peter@lekensteyn.nl>
Wed, 24 Feb 2016 11:56:43 +0000 (11:56 +0000)
The g_hash_table_insert will remove and deallocate existing entry, so we
don't need to do it at all.

Change-Id: I661cadd8beea9585885e48c03a8b52561d1df778
Signed-off-by: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
Reviewed-on: https://code.wireshark.org/review/14113
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
epan/dissectors/packet-nfs.c

index 384f6fd3ba4d472a483e9be0f8c9cbd85221e67a..cdd337d390e2ad10b3dacbdf494554eced60fef0 100644 (file)
@@ -1120,7 +1120,7 @@ static void
 nfs_name_snoop_add_fh(int xid, tvbuff_t *tvb, int fh_offset, int fh_length)
 {
        unsigned char        *fh;
-       nfs_name_snoop_t     *nns, *old_nns;
+       nfs_name_snoop_t     *nns;
        nfs_name_snoop_key_t *key;
 
        /* find which request we correspond to */
@@ -1145,13 +1145,6 @@ nfs_name_snoop_add_fh(int xid, tvbuff_t *tvb, int fh_offset, int fh_length)
        key->fh_length = nns->fh_length;
        key->fh = nns->fh;
 
-       /* already have something matched for this fh, remove it from
-          the table */
-       old_nns = (nfs_name_snoop_t *)g_hash_table_lookup(nfs_name_snoop_matched, key);
-       if (old_nns) {
-               g_hash_table_remove(nfs_name_snoop_matched, key);
-       }
-
        g_hash_table_steal(nfs_name_snoop_unmatched, GINT_TO_POINTER(xid));
        g_hash_table_insert(nfs_name_snoop_matched, key, nns);
 }