Skip to contentSkip to conversation

compress: check for config first

PATCH New Vinod Koul 1 participant 1 message Apr 26, 2013

lore
Share & tools
lore

Vinod Koul

author
#0 lore raw

PATCH 1/1 compress: check for config first

if invalid config is passed, then we return error for memory

---
 compress.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
compress.c +6 -1
index e80e598..ee792c3 100644
@@ -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;
 	}
Signature · 1 line
1.7.0.4