From: Abramo Bagnara Date: Wed, 6 Jun 2001 14:19:40 +0000 (+0000) Subject: Fixed strdup X-Git-Tag: v1.0.3~824 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=f563268fac3fcb83f89362cacfd417c452d0a9ea;p=alsa-lib.git Fixed strdup --- diff --git a/src/pcm/pcm_file.c b/src/pcm/pcm_file.c index d49c2a1e..b28c26a1 100644 --- a/src/pcm/pcm_file.c +++ b/src/pcm/pcm_file.c @@ -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; }