A Lockport man, convicted in 2011 of possession of crack cocaine, may get out of prison sooner than expected in the wake of a ruling from the Appellate Division of State Supreme Court Friday.

The five-judge panel ruled that Niagara County Judge Matthew J. Murphy III did everything right during the trial of Samuel D. McCullough of Washburn Street, but goofed at the sentencing.

On Nov. 21, 2011, Murphy gave McCullough, 38, four years in prison for fourth-degree criminal possession of a controlled substance. The appellate court ruled that the law required Murphy to give McCullough an indeterminate sentence, such as two to four years.

The court ordered that McCullough must be resentenced in line with its ruling, which could bring McCullough up for parole sooner. At present, he isn’t eligible for a parole hearing until May 2014, according to the state prison website.