Wireshark-dev: [Wireshark-dev] Proper private_data usage

From: Christopher Maynard <Christopher.Maynard@xxxxxxxxx>
Date: Tue, 15 Oct 2013 16:00:18 +0000 (UTC)
What is the proper, safe and recommended way to use pinfo->private_data?

If you look at the TCP dissector, you see the following:

        pd_save = pinfo->private_data;
        TRY {
            (*dissect_pdu)(next_tvb, pinfo, tree);
        }
        CATCH_NONFATAL_ERRORS {
            /*  Restore the private_data structure in case one of the
             *  called dissectors modified it (and, due to the exception,
             *  was unable to restore it).
             */
            pinfo->private_data = pd_save;
            show_exception(tvb, pinfo, tree, EXCEPT_CODE, GET_MESSAGE);
        }
        ENDTRY;

I did not check all dissectors, but this is certainly not done for all of
them.  I guess the question I have is, should it?  Is this the recommended
approach?

- Chris