Yesterday I was flying into a Class D airspace underlying a class C airspace VFR. I was under a flight following and approach told me to fly straight in for runway 2. Just after I crossed into the class D airspace. Approach said "Radar services terminated, contact tower". I contacted tower and they were a little bit confused why I was already in there airspace, with a squawk code, while vfr. On my way out I asked tower if I had done something wrong and they said I should have requested to cancel flight following outside of the airspace. Could I have gotten into trouble. I was under 2way communication the entire time with the exception of the switch from approach to tower and I was never asked to squawk 1200. ?


