It was a foul. He shouldn't have been any where near to make that foul.
There are fouls on almost every play, just as there is a holding call on almost every NFL play. The refs normally swallow their whistles in the last few tenths of a game as they don't want to factor into the final score. I have watched tons of one possession games that came down to a missed shot at the end that easily would have been a foul 5-10 minutes earlier in the game. I remember our loss at Louisville a few years back. The Louisville foul on our last possession, clearly a foul but no call.
Happens all the time. The ref blew it.