gluScaleImage()

Hello,
I am trying to map texture to a NURBS surface
that I have generated earlier and I am having
troubles with gluScaleImage(). I can’t scale
my texture correctly and I don’t know why.

I genereted the checker texture as an example
of what I am trying to do:

texture=(GLfloat*)malloc(701303*sizeof(GLfloat));
for (i = 0; i < 70; i++) {
for (j = 0; j < 130; j++) {
texture[i*130*3+j*3+0]= (GLfloat)((((i&0x8)==0)^((j&0x8))==0))*255;
texture[i*130*3+j*3+1]= (GLfloat)((((i&0x8)==0)^((j&0x8))==0))*255;
texture[i*130*3+j*3+2]= (GLfloat)((((i&0x8)==0)^((j&0x8))==0))*255;
}
}

scaled_texture=(GLfloat*)malloc(512*512*3*sizeof(GLfloat));

gluScaleImage(GL_RGB,70,130,GL_FLOAT,texture,512,512,GL_FLOAT,scaled_texture);

If I generate the texture with size 512x512
I can map it to the NURBS surface but if the
size of the texture is not ^2 and I try to use gluScaleImage to scale it (as above),
it seems that the texture is getting damaged.

Please send me an e-mail if you know what is
wrong with my code. I really need help as soon as possible.

Thanks,
Lyubomir