result = stbi__load_and_postprocess_8bit(&s,x,y,comp,req_comp);
if (result) {
// need to 'unget' all the characters in the IO buffer
- if (fseek(f, - (int) (s.img_buffer_end - s.img_buffer), SEEK_CUR) == -1)
+ if (fseek(f, - (int) (s.img_buffer_end - s.img_buffer), SEEK_CUR) == -1) {
+ stbi_image_free(result);
return stbi__errpuc("fseek() error", "File Seek Fail");
+ }
}
return result;
}
result = stbi__load_and_postprocess_16bit(&s,x,y,comp,req_comp);
if (result) {
// need to 'unget' all the characters in the IO buffer
- if (fseek(f, - (int) (s.img_buffer_end - s.img_buffer), SEEK_CUR) == -1)
+ if (fseek(f, - (int) (s.img_buffer_end - s.img_buffer), SEEK_CUR) == -1) {
+ stbi_image_free(result);
return (stbi__uint16 *) stbi__errpuc("fseek() error", "File Seek Fail");
+ }
}
return result;
}