Home page logo

wireshark logo Wireshark mailing list archives

Re: [Wireshark-commits] rev 51395: /trunk/epan/dissectors/ /trunk/epan/dissectors/: packet-rohc.c
From: Pascal Quantin <pascal.quantin () gmail com>
Date: Mon, 19 Aug 2013 13:50:18 +0200

Le 19 août 2013 à 13:24, Evan Huus <eapache () gmail com> a écrit :

On 2013-08-19, at 6:42 AM, Pascal Quantin <pascal.quantin () gmail com> wrote:

2013/8/17 Jakub Zawadzki <darkjames-ws () darkjames pl>
By the way from ROHC code:

2296             data = (guint8 *)ep_alloc(len);
2299             next_tvb = tvb_new_child_real_data(tvb, data, len, len);
2300             add_new_data_source(pinfo, next_tvb, "Payload");

It's very bad idea to use ep-allocated tvb as data source.

Hi Jakub,

I fixed several dissectors using ep allocated memory for data source in r51423. I hope I did not miss any.

That's great Pascal. However, there are some where if an exception gets thrown before the tvb_set_free call then it 
could be a memory leak. If it is not possible to move the set_free to immediately after the allocation (so there is 
nothing to throw an exception) then I suggest allocating in wmem's pinfo->pool instead.


Hi Evan,

I already used the pinfo pool for two dissectors (one because wmem was already used and the opensafety one because ther 
ewas far too many code lines and branches between allocation and the add as data source) and I will do a quick pass to 
see if it can be used for other dissectors as well when I have time.

Sent via:    Wireshark-dev mailing list <wireshark-dev () wireshark org>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request () wireshark org?subject=unsubscribe

  By Date           By Thread  

Current thread:
[ Nmap | Sec Tools | Mailing Lists | Site News | About/Contact | Advertising | Privacy ]