]> git.alsa-project.org Git - alsa-lib.git/commitdiff
Fixed small bug in open()...
authorJaroslav Kysela <perex@perex.cz>
Sun, 1 Nov 1998 23:22:41 +0000 (23:22 +0000)
committerJaroslav Kysela <perex@perex.cz>
Sun, 1 Nov 1998 23:22:41 +0000 (23:22 +0000)
src/control/control.c
src/mixer/mixer.c
src/pcm/pcm.c
src/rawmidi/rawmidi.c

index 5749ea0b975f9978c118d53bddada3936f8bee31..e743474e5228a2ed429b25ef21d910d285fc5dfd 100644 (file)
@@ -50,8 +50,10 @@ int snd_ctl_open( void **handle, int card )
     close( fd );
     return -errno;
   }
-  if ( SND_PROTOCOL_UNCOMPATIBLE( ver, SND_CTL_VERSION_MAX ) )
+  if ( SND_PROTOCOL_UNCOMPATIBLE( ver, SND_CTL_VERSION_MAX ) ) {
+    close( fd );
     return -SND_ERROR_UNCOMPATIBLE_VERSION;
+  }
   ctl = (snd_ctl_t *)calloc( 1, sizeof( snd_ctl_t ) );
   if ( ctl == NULL ) {
     close( fd );
index f385bc99c629c8e3842b5aba200bbd5ce54cb728..0e0a413a61d62770e70932f8a8e9533577f4b4d6 100644 (file)
@@ -29,7 +29,7 @@
 #include "asoundlib.h"
 
 #define SND_FILE_MIXER         "/dev/snd/mixer%i%i"
-#define SND_MIXER_VERSION_MAX  SND_PROTOCOL_VERSION( 1, 0, 1 )
+#define SND_MIXER_VERSION_MAX  SND_PROTOCOL_VERSION( 1, 1, 0 )
  
 typedef struct {
   int card;
@@ -51,8 +51,10 @@ int snd_mixer_open( void **handle, int card, int device )
     close( fd );
     return -errno;
   }
-  if ( SND_PROTOCOL_UNCOMPATIBLE( ver, SND_MIXER_VERSION_MAX ) )
+  if ( SND_PROTOCOL_UNCOMPATIBLE( ver, SND_MIXER_VERSION_MAX ) ) {
+    close( fd );
     return -SND_ERROR_UNCOMPATIBLE_VERSION;
+  }
   mixer = (snd_mixer_t *)calloc( 1, sizeof( snd_mixer_t ) );
   if ( mixer == NULL ) {
     close( fd );
index 5557f13bb340c17019d5a194c8b991aed1824bb0..a4344e4af683758cbb77268e58b482b812a58f56 100644 (file)
@@ -29,7 +29,7 @@
 #include "asoundlib.h"
 
 #define SND_FILE_PCM           "/dev/snd/pcm%i%i"
-#define SND_PCM_VERSION_MAX    SND_PROTOCOL_VERSION( 1, 0, 0 )
+#define SND_PCM_VERSION_MAX    SND_PROTOCOL_VERSION( 1, 0, 1 )
  
 typedef struct {
   int card;
@@ -51,8 +51,10 @@ int snd_pcm_open( void **handle, int card, int device, int mode )
     close( fd );
     return -errno;
   }
-  if ( SND_PROTOCOL_UNCOMPATIBLE( ver, SND_PCM_VERSION_MAX ) )
+  if ( SND_PROTOCOL_UNCOMPATIBLE( ver, SND_PCM_VERSION_MAX ) ) {
+    close( fd );
     return -SND_ERROR_UNCOMPATIBLE_VERSION;
+  }
   pcm = (snd_pcm_t *)calloc( 1, sizeof( snd_pcm_t ) );
   if ( pcm == NULL ) {
     close( fd );
index 6a3b46ec55faf8b41ec6fcbe60826d067197469c..cb1b749db0b39c5cb39e7bf84f4ddd19b32594d6 100644 (file)
@@ -51,8 +51,10 @@ int snd_rawmidi_open( void **handle, int card, int device, int mode )
     close( fd );
     return -errno;
   }
-  if ( SND_PROTOCOL_UNCOMPATIBLE( ver, SND_PCM_VERSION_MAX ) )
+  if ( SND_PROTOCOL_UNCOMPATIBLE( ver, SND_PCM_VERSION_MAX ) ) {
+    close( fd );
     return -SND_ERROR_UNCOMPATIBLE_VERSION;
+  }
   rmidi = (snd_rawmidi_t *)calloc( 1, sizeof( snd_rawmidi_t ) );
   if ( rmidi == NULL ) {
     close( fd );