tests/gdimageline/gdimageline_bug5: add im null judgement (#624)

gdImageCreate returns NULL in gdimageline_bug5.c on AIX, which make the judgement necessary in case of segment fault.
master
wilson chen 2020-05-20 19:29:23 +08:00 committed by GitHub
parent 43df499f1f
commit bc658270f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -10,7 +10,13 @@ int main() {
/* FILE *pngout; */
int black, white;
/* If the data seg size is less than 195000,
* gdImageCrateTrueColor will return NULL.
* See https://github.com/libgd/libgd/issues/621 */
im = gdImageCreateTrueColor(63318, 771);
if (gdTestAssertMsg(im != NULL, "gdImageCreateTrueColor() returns NULL\n") == 0) {
return gdNumFailures();
}
/* Allocate the color white (red, green and blue all maximum). */
white = gdImageColorAllocate(im, 255, 255, 255);