Give this a go:
program test_memleak
implicit none
integer, pointer :: x(:) => NULL()
allocate(x(10))
allocate(x(20))
end program test_memleak
$ gfortran test_memleak.f90
$ valgrind a.out
==543== Memcheck, a memory error detector
==543== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==543== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==543== Command: a.out
==543==
==543==
==543== HEAP SUMMARY:
==543== in use at exit: 120 bytes in 2 blocks
==543== total heap usage: 18 allocs, 16 frees, 2,739 bytes allocated
==543==
==543== LEAK SUMMARY:
==543== definitely lost: 40 bytes in 1 blocks
==543== indirectly lost: 0 bytes in 0 blocks
==543== possibly lost: 0 bytes in 0 blocks
==543== still reachable: 80 bytes in 1 blocks
==543== suppressed: 0 bytes in 0 blocks
==543== Rerun with --leak-check=full to see details of leaked memory
==543==
==543== For counts of detected and suppressed errors, rerun with: -v
==543== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 6 from 6)
Or,
program test_memleak
implicit none
integer, target :: a(20)
integer, pointer :: x(:) => NULL()
allocate(x(10))
x=>a
end program test_memleak
$ gfortran test_memleak.f90
$ valgrind a.out
==987== Memcheck, a memory error detector
==987== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==987== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==987== Command: a.out
==987==
==987==
==987== HEAP SUMMARY:
==987== in use at exit: 40 bytes in 1 blocks
==987== total heap usage: 17 allocs, 16 frees, 2,659 bytes allocated
==987==
==987== LEAK SUMMARY:
==987== definitely lost: 40 bytes in 1 blocks
==987== indirectly lost: 0 bytes in 0 blocks
==987== possibly lost: 0 bytes in 0 blocks
==987== still reachable: 0 bytes in 0 blocks
==987== suppressed: 0 bytes in 0 blocks
==987== Rerun with --leak-check=full to see details of leaked memory
==987==
==987== For counts of detected and suppressed errors, rerun with: -v
==987== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 6 from 6)