Scabrero/fix memory leaks

imo, this `if` is not necesarry - `res` must be valid at this point or `mysql_fetch_row()` should have segfaulted :)