Liles' contract is not that bad. He got paid market price. Yes, he can be shaky at times but he's only slightly overpaid and he really is average defensively more so than anything else for an offensive defenseman.
Like everything, it's a matter of perspective. If one considers Liles to be a top-4 defenseman in the NHL, his $4M price seems right on par with the range most teams spend on their top 4. If one looks at Liles as a one-dimensional PP specialist - which he doesn't seem to be IMO - then the salary is too high.