Slight tidy-up of the code.

This commit is contained in:
Tigran Aivazian
2012-10-11 22:10:02 +01:00
committed by Qingping Hou
parent cac63cd390
commit 7609fc2dd0

8
pic.c
View File

@@ -137,13 +137,11 @@ static int openDocument(lua_State *L) {
doc->image = raw_image;
else if (components == 3) {
uint8_t *gray_image = rgbToGrayscale(raw_image, width, height);
if (!gray_image) {
free(raw_image);
free(raw_image);
if (!gray_image)
return luaL_error(L, "Cannot convert to grayscale");
} else {
free(raw_image);
else
doc->image = gray_image;
}
} else
return luaL_error(L, "Unsupported image format");