-1

Is it possible to configure Valgrind to return a non-zero exit status if invalid reads are detected but no actual memory leaks?

(I want to use Valgrind as part of some automated tests for student C code submissions.)

Zack
  • 6,232
  • 8
  • 38
  • 68
  • Have you thought about passing the output of valgrind through eg. a bash script checking the parts you are interested about and returning own error codes? – PhilMasteG May 26 '22 at 16:44
  • 1
    Seen `--error-exitcode` at https://linux.die.net/man/1/valgrind? – Jeff Holt May 26 '22 at 16:44
  • Yes. valgrind |& grep "Invalid" will tell me what I want to know. I was just curious if there was a simpler solution. – Zack May 26 '22 at 17:26
  • --error-exitcode is working now. I swear it wasn't when I tried it initially. (A more detailed answer is here: https://stackoverflow.com/questions/19246470/how-to-get-in-script-whether-valgrind-found-memory-leaks) – Zack Dec 19 '22 at 22:24

1 Answers1

0

You can use the option --error-for-leak-kinds=none :

--errors-for-leak-kinds=kind1,kind2,..  which leak kinds are errors?
                                              [definite,possible]
   where kind is one of:
     definite indirect possible reachable all none
phd
  • 3,669
  • 1
  • 11
  • 12