Free raw_image if it is unsupported.

If the number of colour components is neither 1 nor 3 we should remember
to free the buffer holding the raw decoded image before returning the
error to Lua.
pull/2/merge
Tigran Aivazian 12 years ago committed by Qingping Hou
parent 74a60eeea2
commit 01ce094adb

@ -142,8 +142,10 @@ static int openDocument(lua_State *L) {
return luaL_error(L, "Cannot convert to grayscale");
else
doc->image = gray_image;
} else
} else {
free(raw_image);
return luaL_error(L, "Unsupported image format");
}
doc->width = width;
doc->height = height;

Loading…
Cancel
Save