[alsa-devel] [PATCH - TINYCOMPRESS 2/4] compress: Return error when failing to allocate compress struct

Charles Keepax ckeepax at opensource.wolfsonmicro.com
Fri Jan 25 11:43:12 CET 2013


Signed-off-by: Charles Keepax <ckeepax at opensource.wolfsonmicro.com>

diff --git a/compress.c b/compress.c
index 05e54ae..51455fc 100644
--- a/compress.c
+++ b/compress.c
@@ -207,8 +207,10 @@ struct compress *compress_open(unsigned int card, unsigned int device,
 	int rc;
 
 	compress = calloc(1, sizeof(struct compress));
-	if (!compress || !config)
+	if (!compress || !config) {
+		oops(&bad_compress, errno, "cannot allocate compress object");
 		return &bad_compress;
+	}
 
 	compress->config = config;
 
-- 
1.7.2.5



More information about the Alsa-devel mailing list