kmshttpendpoint: Fix memory leak managing caps

Change-Id: Ie20eabff58153eed3b3b01bb7b63ad521ba5e746