https://bugs.kde.org/show_bug.cgi?id=469565

            Bug ID: 469565
           Summary: valgrind not detecting simple leak with malloc(In Arm
                    System)
    Classification: Developer tools
           Product: valgrind
           Version: 3.21 GIT
          Platform: Ubuntu
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: memcheck
          Assignee: jsew...@acm.org
          Reporter: tym15105753...@gmail.com
  Target Milestone: ---

Created attachment 158821
  --> https://bugs.kde.org/attachment.cgi?id=158821&action=edit
left is my x86 ubuntu 20.04 and right is arm linux

STEPS TO REPRODUCE

1.folloing is my test code, and i use arm-linux-gnueabihf-gcc -g leak.c -o leak
to compile it

//leak.c
#include <stdio.h>
#include <stdlib.h>

void func()
{
    char *str = (char *)malloc(8);

    str[8] = 9;

    return;
}

int main()
{
    int i = 1;

    int *p = (int *)malloc(100);

    printf("i : %d\n", i);

    func();

    return 0;
}

2.my gcc version output is 

Using built-in specs.
COLLECT_GCC=arm-linux-gnueabihf-gcc
gcc version 9.1.0 (GCC) 

3. valgrind source code is download form
https://sourceware.org/pub/valgrind/valgrind-3.21.0.tar.bz2, following is my
compile process:
./autogen.sh
./configure --prefix=$output --host=arm-linux-gnueabihf
make -j6 && sudo make install

4.then i upload all files that Valgrind depends on running to the arm linux,it
can run successfully

5.finally i use ./valgrind --leak-check=full ./leak and vlagrind tips as
follows

~ $ ./valgrind --leak-check=full ./leak 
11111111111111111!
toolfile : /home/admin/memcheck-arm-linux
==1581== Memcheck, a memory error detector
==1581== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==1581== Using Valgrind-3.21.0 and LibVEX; rerun with -h for copyright info
==1581== Command: ./leak
==1581== 
i : 1
test ok!
==1581== 
==1581== HEAP SUMMARY:
==1581==     in use at exit: 0 bytes in 0 blocks
==1581==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==1581== 
==1581== All heap blocks were freed -- no leaks are possible
==1581== 
==1581== For lists of detected and suppressed errors, rerun with: -s
==1581== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)


SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Linux version 4.9.84 (root@cx-System-Product-Name) (gcc
version 9.1.0 (GCC) )


ADDITIONAL INFORMATION

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to