compress: check for config first
PATCH 1/1 compress: check for config first
if invalid config is passed, then we return error for memory
Signed-off-by Vinod Koul <[email protected]>
--- compress.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)
compress.c +6 -1
@@ -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