platedetector: Fix memory leaks

Change-Id: I27541091ede5faff5331eb0486115a749a71ec39