Am 01.11.2011 23:42, schrieb Alan Coopersmith:
> Signed-off-by: Alan Coopersmith <[email protected]>
> ---
>  glx/single2.c |    4 +---
>  1 files changed, 1 insertions(+), 3 deletions(-)
> 
> diff --git a/glx/single2.c b/glx/single2.c
> index 9884f40..9f8254b 100644
> --- a/glx/single2.c
> +++ b/glx/single2.c
> @@ -351,12 +351,10 @@ int DoGetString(__GLXclientState *cl, GLbyte *pc, 
> GLboolean need_swap)
>      }
>      else if ( name == GL_VERSION ) {
>       if ( atof( string ) > atof( GLServerVersion ) ) {
> -         buf = malloc( strlen( string ) + strlen( GLServerVersion ) + 4 );
> -         if ( buf == NULL ) {
> +         if ( asprintf( &buf, "%s (%s)", GLServerVersion, string ) == -1) {
>               string = GLServerVersion;
>           }
>           else {
> -             sprintf( buf, "%s (%s)", GLServerVersion, string );
>               string = buf;
>           }
>       }

I am not sure that string = GLServerVersion in an OOM condition is the right 
idea.
Having an exit(1) gives the system a chance to recover.

re,
 wh
_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to