Rémi Bernon (@rbernon) commented about dlls/opengl32/wgl.c:
if ((status = UNIX_CALL( wglChoosePixelFormatARB, &args )))
WARN( "wglChoosePixelFormatARB returned %#lx\n", status );
return args.ret;
- }
- /* Initialize the format_array with (pointers to) all wgl formats */
- format_array = malloc( num_wgl_formats * sizeof(*format_array) );
- if (!format_array) return FALSE;
- for (i = 0; i < num_wgl_formats; ++i) format_array[i] = &wgl_formats[i];
- /* Remove formats that are not acceptable */
- for (i = 0; attribs_int && attribs_int[i]; i += 2)
- {
if (ctx.num_attribs == ARRAY_SIZE(ctx.attribs)) { free( format_array ); return FALSE; }
What about either making this an assert, or (especially if it's possible to have duplicate attributes), counting them upfront and allocating the context dynamically?