Wireshark-dev: Re: [Wireshark-dev] Out of Memory issue
From: "Kumar, Hemant" <kumarh@xxxxxxxxxxxx>
Date: Sat, 26 Jul 2008 01:23:24 -0700
Hello Harris and Jaap
Thanks for all the support.
The problem was indeed with my message as the capture I made was
>From a faulty interface and so some of the packets contained
Wrong message id etc fields leading to junk value in message
Pointer and actually this happened after dissecting 16000
Something messages so I couldn't guess it in the first glance.
Anyway Thanks for going through my mails time and again.
Hemant
-----Original Message-----
From: Kumar, Hemant
Sent: Saturday, July 26, 2008 12:18 AM
To: 'Developer support list for Wireshark'
Subject: RE: [Wireshark-dev] Out of Memory issue
Hello Harris
To clarify
The following code snippet do not works:---
> if (check_col(pinfo->cinfo,COL_INFO))
> {
>
> temp_str = ep_alloc(STRING_BUFFER);
> printf( "[%s] %s ", message->direction,
> message->message_type);
> }
And the following does work with only ep_alloc()
if (check_col(pinfo->cinfo,COL_INFO))
{
temp_str = ep_alloc(STRING_BUFFER);
}
So it seems some memeory allocation error with message->direction, message->message_type is occuring .But actually the message just points to a
Static array element of message type structure so there is no need for
Deallocation for static array or is it?
Thanks
Hemant
-----Original Message-----
From: wireshark-dev-bounces@xxxxxxxxxxxxx [mailto:wireshark-dev-bounces@xxxxxxxxxxxxx] On Behalf Of Guy Harris
Sent: Friday, July 25, 2008 3:45 PM
To: Developer support list for Wireshark
Subject: Re: [Wireshark-dev] Out of Memory issue
On Jul 25, 2008, at 3:23 PM, Kumar, Hemant wrote:
> Even if I comment as shown below and add a simple printf statement
> it fails but if I just keep the first line ep_alloc() and comment
> everything
> With no printf addition then it works.:--
>
> if (check_col(pinfo->cinfo,COL_INFO))
> {
>
> temp_str = ep_alloc(STRING_BUFFER);
> printf( "[%s] %s ", message->direction,
> message->message_type);
> // g_snprintf( temp_str, sizeof(temp_str), "[%s]
> %s ", message->direction, message->message_type);
> // col_add_str(pinfo->cinfo, COL_INFO, temp_str);
>
> }
So that sample does, or doesn't, work?
If it doesn't work, is the code that does work
if (check_col(pinfo->cinfo,COL_INFO))
{
temp_str = ep_alloc(STRING_BUFFER);
// printf( "[%s] %s ", message->direction,
message->message_type);
// g_snprintf( temp_str, sizeof(temp_str), "[%s]
%s ", message->direction, message->message_type);
// col_add_str(pinfo->cinfo, COL_INFO, temp_str);
}
or, equivalently:
if (check_col(pinfo->cinfo,COL_INFO))
{
temp_str = ep_alloc(STRING_BUFFER);
// g_snprintf( temp_str, sizeof(temp_str), "[%s]
%s ", message->direction, message->message_type);
// col_add_str(pinfo->cinfo, COL_INFO, temp_str);
}
(i.e., "just keep the first line ep_alloc()" and "comment everything
with no printf addition"?
By the way, there's a "col_add_fstr()" routine which takes a format
string and an argument list, so you can just do
if (check_col(pinfo->cinfo, COL_INFO))
{
col_add_fstr(pinfo->cinfo, COL_INFO, "[%s] %s ", message-
>direction, message->message_type);
}
You also don't have to do
if (check_col(pinfo->cinfo,COL_INFO))
{
col_clear(pinfo->cinfo,COL_INFO);
}
if, immediately after that, you're going to set the string.
_______________________________________________
Wireshark-dev mailing list
Wireshark-dev@xxxxxxxxxxxxx
https://wireshark.org/mailman/listinfo/wireshark-dev
- References:
- [Wireshark-dev] Out of Memory issue
- From: Kumar, Hemant
- Re: [Wireshark-dev] Out of Memory issue
- From: Guy Harris
- Re: [Wireshark-dev] Out of Memory issue
- From: Kumar, Hemant
- Re: [Wireshark-dev] Out of Memory issue
- From: Guy Harris
- [Wireshark-dev] Out of Memory issue
- Prev by Date: Re: [Wireshark-dev] Out of Memory issue
- Next by Date: [Wireshark-dev] Overriding CC from command line
- Previous by thread: Re: [Wireshark-dev] Out of Memory issue
- Next by thread: [Wireshark-dev] interesting issues with multiple calls to dissector
- Index(es):