pbm: Free raw_buf if output buffer's malloc fails
pbm: Skip garbage bits in last byte of the row
pbm: Fix raw_buf_size calculation