[PATCH 4/7] Convert glx/single2.c:DoGetString() to use asprintf()
Alan Coopersmith
alan.coopersmith at oracle.com
Tue Nov 1 15:42:19 PDT 2011
Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
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;
}
}
--
1.7.3.2
More information about the xorg-devel
mailing list