]> git.alsa-project.org Git - alsa-lib.git/commitdiff
Fixed strdup
authorAbramo Bagnara <abramo@alsa-project.org>
Wed, 6 Jun 2001 14:19:40 +0000 (14:19 +0000)
committerAbramo Bagnara <abramo@alsa-project.org>
Wed, 6 Jun 2001 14:19:40 +0000 (14:19 +0000)
src/pcm/pcm_file.c

index d49c2a1e5ad276588bef45670941c79468691efb..b28c26a1eae5c5c85814f87b91737a481ab0880d 100644 (file)
@@ -422,8 +422,9 @@ int snd_pcm_file_open(snd_pcm_t **pcmp, const char *name, const char *fname, int
                        close(fd);
                return -ENOMEM;
        }
-
-       file->fname = strdup(fname);
+       
+       if (fname)
+               file->fname = strdup(fname);
        file->fd = fd;
        file->format = format;
        file->slave = slave;
@@ -431,6 +432,8 @@ int snd_pcm_file_open(snd_pcm_t **pcmp, const char *name, const char *fname, int
 
        pcm = calloc(1, sizeof(snd_pcm_t));
        if (!pcm) {
+               if (fname)
+                       free(file->fname);
                free(file);
                return -ENOMEM;
        }