Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* ************************************************************************** */
- #include <stdlib.h>
- #include <stdio.h>
- /* ************************************************************************** */
- int main(void)
- {
- char *mem_;
- if (!(mem_ = (char *)malloc(sizeof(char) * 64)))
- {
- return (0); // or exit(-1) anywhere else in the code.
- }
- ////////////////////////////////////////////////////////////////////////////
- // After the next instruction, the allocated memory location will be forever
- // lost, causing a memory leak. Comment it to avoid any leaks.
- ////////////////////////////////////////////////////////////////////////////
- mem_ = NULL;
- ////////////////////////////////////////////////////////////////////////////
- while (42)
- {
- ;
- }
- return (0);
- }
- /* ************************************************************************** */
- /* valgrind --leak-check=full ./a.out */
- /* ************************************************************************** */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement