大家晚上好。
我编写了一个函数,通过分析每个字符来检查来自流的值。如果角色具有特定符号的值,则代码应该在程序中执行更深入的操作。
一切正常,但Valgrind抱怨使用的fgetc功能。我不明白为什么。
func presentationCompletionAction(completeTransition: Bool) {
self.imageView.hidden = false
self.imageView.image = selectedCell.selectedImageView?.image
}
下面是我的代码:
==12681== Memcheck, a memory error detector
==12681== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==12681== Using Valgrind-3.10.0 and LibVEX; rerun with -h for copyright info
==12681== Command: /tmp/3RKi4ZeFa74f-a.out tests/15_defaultFitting output/ausgabe_15_defaultFitting
==12681==
==12681== Invalid read of size 4
==12681== at 0x4EA69E1: getc (getc.c:38)
==12681== by 0x400B58: checkUp (1441398601.c:36)
==12681== by 0x402453: main (1441398601.c:891)
==12681== Address 0x0 is not stack'd, malloc'd or (recently) free'd
==12681==
==12681==
==12681== Process terminating with default action of signal 11 (SIGSEGV)
==12681== Access not within mapped region at address 0x0
==12681== at 0x4EA69E1: getc (getc.c:38)
==12681== by 0x400B58: checkUp (1441398601.c:36)
==12681== by 0x402453: main (1441398601.c:891)
==12681== If you believe this happened as a result of a stack
==12681== overflow in your program's main thread (unlikely but
==12681== possible), you can try to increase the size of the
==12681== main thread stack using the --main-stacksize= flag.
==12681== The main thread stack size used in this run was 8388608.
==12681==
==12681== HEAP SUMMARY:
==12681== in use at exit: 0 bytes in 0 blocks
==12681== total heap usage: 1 allocs, 1 frees, 568 bytes allocated
==12681==
==12681== All heap blocks were freed -- no leaks are possible
==12681==
==12681== For counts of detected and suppressed errors, rerun with: -v
==12681== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
如果有人可以告诉我Valgrind的消息是什么原因,我会非常感激。我没有想法。提前谢谢。