On Thu, Feb 6, 2014 at 7:11 AM, Chaitanya Gulhane <
chaitanya.gulh...@gmail.com> wrote:

>
> Hi,
>
> I was using net-snmp 5.6.2 and have built the code and installed it.
>
> I was using valgrind over snmptrap command.
> Following is the command I ran.
>
> valgrind --leak-check=full --log-file=log_snmptrap snmptrap -v 2c -c
> public "" localhost UCD-TRAP-TEST-MIB::demoTrap
>
>
> Following is the valgrind logging
>
> ==20969== Memcheck, a memory error detector
> ==20969== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.
> ==20969== Using Valgrind-3.6.0 and LibVEX; rerun with -h for copyright info
> ==20969== Command: snmptrap -v 2c -c public  localhost
> UCD-TRAP-TEST-MIB::demoTrap
> ==20969== Parent PID: 2080
> ==20969==
> ==20969== Invalid read of size 8
> ==20969==    at 0x35B0E84F66: __GI___strcasecmp_l (in /lib64/libc-2.12.so)
> ==20969==    by 0x4C5F6EB: read_config_find_handler (read_config.c:504)
> ==20969==    by 0x4C5F717: run_config_handler (read_config.c:520)
> ==20969==    by 0x4C5FE74: read_config (read_config.c:934)
> ==20969==    by 0x4C60A98: read_config_files_in_path (read_config.c:1277)
> ==20969==    by 0x4C60E7B: read_config_files_of_type (read_config.c:1365)
> ==20969==    by 0x4C60ED2: read_config_files (read_config.c:1401)
> ==20969==    by 0x4C6146E: read_premib_configs (read_config.c:1045)
> ==20969==    by 0x4C43C92: init_snmp (snmp_api.c:848)
> ==20969==    by 0x4C58F86: netsnmp_parse_args (snmp_parse_args.c:641)
> ==20969==    by 0x4012A1: main (snmptrap.c:147)
> ==20969==  Address 0x4f01c18 is 8 bytes inside a block of size 10 alloc'd
> ==20969==    at 0x4A05236: malloc (vg_replace_malloc.c:236)
> ==20969==    by 0x35B0E81081: strdup (in /lib64/libc-2.12.so)
> ==20969==    by 0x4C61D17: internal_register_config_handler
> (read_config.c:229)
> ==20969==    by 0x4C61B4A: internal_register_config_handler
> (read_config.c:185)
> ==20969==    by 0x4C73E1B: netsnmp_register_service_handlers
> (snmp_service.c:407)
> ==20969==    by 0x4C43C6E: init_snmp (snmp_api.c:791)
> ==20969==    by 0x4C58F86: netsnmp_parse_args (snmp_parse_args.c:641)
> ==20969==    by 0x4012A1: main (snmptrap.c:147)
> ==20969==
> ==20969== Conditional jump or move depends on uninitialised value(s)
> ==20969==    at 0x35B0E84FCB: __GI___strcasecmp_l (in /lib64/libc-2.12.so)
> ==20969==    by 0x4C5F6EB: read_config_find_handler (read_config.c:504)
> ==20969==    by 0x4C5F717: run_config_handler (read_config.c:520)
> ==20969==    by 0x4C5FE74: read_config (read_config.c:934)
> ==20969==    by 0x4C60A98: read_config_files_in_path (read_config.c:1277)
> ==20969==    by 0x4C60E7B: read_config_files_of_type (read_config.c:1365)
> ==20969==    by 0x4C60ED2: read_config_files (read_config.c:1401)
> ==20969==    by 0x4C6146E: read_premib_configs (read_config.c:1045)
> ==20969==    by 0x4C43C92: init_snmp (snmp_api.c:848)
> ==20969==    by 0x4C58F86: netsnmp_parse_args (snmp_parse_args.c:641)
> ==20969==    by 0x4012A1: main (snmptrap.c:147)
> ==20969==
> ==20969== Use of uninitialised value of size 8
> ==20969==    at 0x35B0E87104: __GI___strcasecmp_l (in /lib64/libc-2.12.so)
> ==20969==    by 0x4C5F6EB: read_config_find_handler (read_config.c:504)
> ==20969==    by 0x4C5F717: run_config_handler (read_config.c:520)
> ==20969==    by 0x4C5FE74: read_config (read_config.c:934)
> ==20969==    by 0x4C60A98: read_config_files_in_path (read_config.c:1277)
> ==20969==    by 0x4C60E7B: read_config_files_of_type (read_config.c:1365)
> ==20969==    by 0x4C60ED2: read_config_files (read_config.c:1401)
> ==20969==    by 0x4C6146E: read_premib_configs (read_config.c:1045)
> ==20969==    by 0x4C43C92: init_snmp (snmp_api.c:848)
> ==20969==    by 0x4C58F86: netsnmp_parse_args (snmp_parse_args.c:641)
> ==20969==    by 0x4012A1: main (snmptrap.c:147)
> ==20969==
> ==20969== Use of uninitialised value of size 8
> ==20969==    at 0x35B0E87108: __GI___strcasecmp_l (in /lib64/libc-2.12.so)
> ==20969==    by 0x4C5F6EB: read_config_find_handler (read_config.c:504)
> ==20969==    by 0x4C5F717: run_config_handler (read_config.c:520)
> ==20969==    by 0x4C5FE74: read_config (read_config.c:934)
> ==20969==    by 0x4C60A98: read_config_files_in_path (read_config.c:1277)
> ==20969==    by 0x4C60E7B: read_config_files_of_type (read_config.c:1365)
> ==20969==    by 0x4C60ED2: read_config_files (read_config.c:1401)
> ==20969==    by 0x4C6146E: read_premib_configs (read_config.c:1045)
> ==20969==    by 0x4C43C92: init_snmp (snmp_api.c:848)
> ==20969==    by 0x4C58F86: netsnmp_parse_args (snmp_parse_args.c:641)
> ==20969==    by 0x4012A1: main (snmptrap.c:147)
> ==20969==
> ==20969== Invalid read of size 8
> ==20969==    at 0x35B0E84F5D: __GI___strcasecmp_l (in /lib64/libc-2.12.so)
> ==20969==    by 0x4C7501D: find_tdomain (snmp_transport.c:427)
> ==20969==    by 0x4C753AE: netsnmp_tdomain_transport_full
> (snmp_transport.c:613)
> ==20969==    by 0x401323: main (snmptrap.c:218)
> ==20969==  Address 0x4ef8d50 is 0 bytes inside a block of size 4 alloc'd
> ==20969==    at 0x4A05236: malloc (vg_replace_malloc.c:236)
> ==20969==    by 0x35B0E81081: strdup (in /lib64/libc-2.12.so)
> ==20969==    by 0x4C7421A: create_word_array_helper (snmp_service.c:15)
> ==20969==    by 0x4C742B9: create_word_array (snmp_service.c:31)
> ==20969==    by 0x4C745A9: netsnmp_register_default_domain
> (snmp_service.c:87)
> ==20969==    by 0x4C43218: _init_snmp (snmp_api.c:694)
> ==20969==    by 0x4C433B8: snmp_sess_init (snmp_api.c:730)
> ==20969==    by 0x4C581E4: netsnmp_parse_args (snmp_parse_args.c:210)
> ==20969==    by 0x4012A1: main (snmptrap.c:147)
> ==20969==
> ==20969== Invalid read of size 8
> ==20969==    at 0x35B0E84F66: __GI___strcasecmp_l (in /lib64/libc-2.12.so)
> ==20969==    by 0x4C7501D: find_tdomain (snmp_transport.c:427)
> ==20969==    by 0x4C753AE: netsnmp_tdomain_transport_full
> (snmp_transport.c:613)
> ==20969==    by 0x401323: main (snmptrap.c:218)
> ==20969==  Address 0x4ef8d58 is 4 bytes after a block of size 4 alloc'd
> ==20969==    at 0x4A05236: malloc (vg_replace_malloc.c:236)
> ==20969==    by 0x35B0E81081: strdup (in /lib64/libc-2.12.so)
> ==20969==    by 0x4C7421A: create_word_array_helper (snmp_service.c:15)
> ==20969==    by 0x4C742B9: create_word_array (snmp_service.c:31)
> ==20969==    by 0x4C745A9: netsnmp_register_default_domain
> (snmp_service.c:87)
> ==20969==    by 0x4C43218: _init_snmp (snmp_api.c:694)
> ==20969==    by 0x4C433B8: snmp_sess_init (snmp_api.c:730)
> ==20969==    by 0x4C581E4: netsnmp_parse_args (snmp_parse_args.c:210)
> ==20969==    by 0x4012A1: main (snmptrap.c:147)
> ==20969==
> ==20969==
> ==20969== HEAP SUMMARY:
> ==20969==     in use at exit: 42 bytes in 3 blocks
> ==20969==   total heap usage: 19,431 allocs, 19,428 frees, 1,140,080 bytes
> allocated
> ==20969==
> *==20969== 17 bytes in 1 blocks are definitely lost in loss record 2 of 3*
> *==20969==    at 0x4A05236: malloc (vg_replace_malloc.c:236)*
> *==20969==    by 0x4C66C51: snmpv3_generate_engineID (snmpv3.c:1563)*
> *==20969==    by 0x401652: main (snmptrap.c:175)*
> *==20969== *
> *==20969== 18 bytes in 1 blocks are definitely lost in loss record 3 of 3*
> *==20969==    at 0x4A05236: malloc (vg_replace_malloc.c:236)*
> *==20969==    by 0x40122D: main (snmptrap.c:143)*
> ==20969==
> ==20969== LEAK SUMMARY:
> *==20969==    definitely lost: 35 bytes in 2 blocks*
> ==20969==    indirectly lost: 0 bytes in 0 blocks
> ==20969==      possibly lost: 0 bytes in 0 blocks
> ==20969==    still reachable: 7 bytes in 1 blocks
> ==20969==         suppressed: 0 bytes in 0 blocks
> ==20969== Reachable blocks (those to which a pointer was found) are not
> shown.
> ==20969== To see them, rerun with: --leak-check=full --show-reachable=yes
> ==20969==
> ==20969== For counts of detected and suppressed errors, rerun with: -v
> ==20969== Use --track-origins=yes to see where uninitialised values come
> from
> ==20969== ERROR SUMMARY: 100 errors from 8 contexts (suppressed: 4 from
>
>
> I came to know highlighted memory leaks.
>
> Is any patch available for the same?
>

Why do those leaks affect you?  Are you calling main() multiple times in a
long-running process in a way that it will allocate these chunks multiple
times?  Does your system not release allocated memory when a process exits?

(I would be much more worried about the uninitialized value uses than the
leaks, myself).

Finally, have you tried the most recent release, instead of 5.6.2?

  Bill
------------------------------------------------------------------------------
Androi apps run on BlackBerry 10
Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
Now with support for Jelly Bean, Bluetooth, Mapview and more.
Get your Android app in front of a whole new audience.  Start now.
http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to