[alsa-devel] [TINYCOMPRESS][PATCH] compress: check for config first
Vinod Koul
vinod.koul at intel.com
Fri Apr 26 18:54:30 CEST 2013
if invalid config is passed, then we return error for memory
Signed-off-by: Vinod Koul <vinod.koul at intel.com>
---
compress.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/compress.c b/compress.c
index e80e598..ee792c3 100644
--- a/compress.c
+++ b/compress.c
@@ -218,8 +218,13 @@ struct compress *compress_open(unsigned int card, unsigned int device,
struct snd_compr_caps caps;
char fn[256];
+ if (!config) {
+ oops(&bad_compress, -EINVAL, "passed bad config");
+ return &bad_compress;
+ }
+
compress = calloc(1, sizeof(struct compress));
- if (!compress || !config) {
+ if (!compress) {
oops(&bad_compress, errno, "cannot allocate compress object");
return &bad_compress;
}
--
1.7.0.4
More information about the Alsa-devel
mailing list