glapi/glx: Sync some additional error checking from xserver
authorAdam Jackson <ajax@redhat.com>
Thu, 24 Mar 2016 17:57:58 +0000 (13:57 -0400)
committerAdam Jackson <ajax@redhat.com>
Tue, 29 Mar 2016 14:10:57 +0000 (10:10 -0400)
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
src/mapi/glapi/gen/glX_proto_recv.py

index 1cfa8c5c142cf749cfd377c130fe6d7189da853e..cf5b59c124ac3aca8afd3867e4bdb521a6060987 100644 (file)
@@ -437,6 +437,10 @@ class PrintGlxDispatchFunctions(glX_proto_common.glx_print_proto):
                 print '        %s %s = __glXGetAnswerBuffer(cl, %s%s, answerBuffer, sizeof(answerBuffer), %u);' % (param.type_string(), param.name, param.counter, size_scale, type_size)
                 answer_string = param.name
                 answer_count = param.counter
+                print ''
+                print '        if (%s == NULL) return BadAlloc;' % (param.name)
+                print '        __glXClearErrorOccured();'
+                print ''
             elif c >= 1:
                 print '        %s %s[%u];' % (answer_type, param.name, c)
                 answer_string = param.name