Source

gd-libgd / src / gd_tga.c

Diff from to

src/gd_tga.c

 			break;
 	}
 
-	tga->ident = (char *) gdMalloc(tga->identsize * sizeof( char ));
-	if (tga->ident == NULL) {
-		return -1;
-	}
+	tga->ident = NULL;
 
 	if (tga->identsize > 0) {
+		tga->ident = (char *) gdMalloc(tga->identsize * sizeof(char));
+		if(tga->ident == NULL) {
+			return -1;
+		}
+
 		gdGetBuf( &( tga->ident ), tga->identsize, ctx );
 	}