This popped up in my head recently. I'm pretty sure I own a Kindle book for this, but I'm not having much luck searching for it. The main character is a pudgy boy who is sent off to a magic school. I believe he came from a line of evil magicians, and is expected to follow in that line. He, however, is a reasonably decent sort. I remember him as being quite hapless, including, I think, losing his money from a thief while he slept on the train ride up. As is fairly typical for English schools, and books following Harry Potter, he is sorted into a house. He is frequently bullied by the other students. And I remember that he participates in some sort of a game that combines Capture the Flag with the use of offensive magic, with his first game ending with him hung upside down by a spell, his robes falling away from the lower half of his body, increasing his embarrassment.
I'm pretty sure that I read the first parts of it about 5 years ago, although there's a decent chance that the book is older. I don't think that I bought the book, but rather found it as a free one. I am fairly certain that it was the first book in a series, although I couldn't say the length.