File tree Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -3049,8 +3049,8 @@ int gdImagePaletteToTrueColor(gdImagePtr src)
3049
3049
}
3050
3050
}
3051
3051
3052
- /* free old palette buffer */
3053
- for (yy = y - 1 ; yy >= yy - 1 ; yy -- ) {
3052
+ /* free old palette buffer (y is sy) */
3053
+ for (yy = 0 ; yy < y ; yy ++ ) {
3054
3054
gdFree (src -> pixels [yy ]);
3055
3055
}
3056
3056
gdFree (src -> pixels );
@@ -3067,13 +3067,11 @@ int gdImagePaletteToTrueColor(gdImagePtr src)
3067
3067
return 1 ;
3068
3068
3069
3069
clean_on_error :
3070
- if (y > 0 ) {
3071
-
3072
- for (yy = y ; yy >= yy - 1 ; y -- ) {
3073
- gdFree (src -> tpixels [y ]);
3074
- }
3075
- gdFree (src -> tpixels );
3070
+ /* free new true color buffer (y is not allocated, have failed) */
3071
+ for (yy = 0 ; yy < y ; yy ++ ) {
3072
+ gdFree (src -> tpixels [yy ]);
3076
3073
}
3074
+ gdFree (src -> tpixels );
3077
3075
return 0 ;
3078
3076
}
3079
3077
You can’t perform that action at this time.
0 commit comments