From 31d610dada358232dfa458169da3e57c114d851c Mon Sep 17 00:00:00 2001 From: Vinod Koul Date: Fri, 26 Apr 2013 22:20:00 +0530 Subject: [PATCH] compress: check for config first if invalid config is passed, then we return error for memory Signed-off-by: Vinod Koul --- compress.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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; } -- 2.47.3