Texture dimensions not power of 2

Greetings:
Red book 7th ed says:
"For OpenGL implementations that do not support version 2.0 or greater, both width and height must have the form 2^m + 2b, ... For OpenGL implementations supporting version 2.0 and greater, textures may be of any size."

as i said, you have padding issues. the problem is not your texture is NPOT, but it is 4-byte aligned(so at the end of every row it has zero-bytes to make row size multiple of 4). while you reading it as a continuous RGB-array.
you can fix it dirty way, just to ensure i'm correct by placing these calls in your code(before passing image to opengl):