내 시스템에 메모리 누수를 찾을 수 Valgrind의를 사용하고, 나는 그것은 오류가 없다라고하지만 kernel.c에 초기화되지 않은 값이이 출력Valgrind의 Memcheck 출력
==9697== Memcheck, a memory error detector
==9697== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
==9697== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
==9697== Command: bin/vfirewall-monitor
==9697==
==9697==
==9697== HEAP SUMMARY:
==9697== in use at exit: 0 bytes in 0 blocks
==9697== total heap usage: 1 allocs, 1 frees, 37 bytes allocated
==9697==
==9697== All heap blocks were freed -- no leaks are possible
==9697==
==9697== For counts of detected and suppressed errors, rerun with: -v
==9697== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 2 from 2)
==9700== Thread 2:
==9700== Conditional jump or move depends on uninitialised value(s)
==9700== at 0x56DE3B1: vfprintf (vfprintf.c:1630)
==9700== by 0x5706441: vsnprintf (vsnprintf.c:120)
==9700== by 0x56E6971: snprintf (snprintf.c:35)
==9700== by 0x403A1A: save_interfaces_info (interfaces.c:351)
==9700== by 0x403DC4: get_all_system_info (kernel.c:135)
==9700== by 0x547DE99: start_thread (pthread_create.c:308)
==9700== by 0x57873FC: clone (clone.S:112)
==9700== Uninitialised value was created by a heap allocation
==9700== at 0x4C2B6CD: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==9700== by 0x403D6F: get_all_system_info (kernel.c:118)
==9700== by 0x547DE99: start_thread (pthread_create.c:308)
==9700== by 0x57873FC: clone (clone.S:112)
==9700==
을받은 : 118. 내가 여기에 잘못이 무엇인지 이해하지 못하는
117 Interface * ifaces;
118 ifaces = malloc(sizeof (Interface));
119 ifaces->next_interface = NULL;
:
는 그리고 이것은 118에서 내 1kernel.c1입니다. 나는 틀린 장소에서보고 있는가? 아니면 valgrind가 잘못된 로그를 읽었습니까?
실제로, 나는이 인터페이스를 가지고 있습니다. : 351 'char sql [300] = ""; 값 ('% s', '% s', '% s', '% s') VALUES (nome, endereco_ipv4, mac_address, ativa) snprintf (sql, sizeof (sql) iface-> interface_mac_addr, iface-> interface_active == INTERFACE_ACTIVE? "true": "false"); ' –
'초기화되지 않은 값은'Interface'의 첫 번째 멤버입니다 편집을 참조하십시오. –