commit 222099ba0a96a08af154641dbab342243afd1807
parent 5dfe0aa3dbd6568360c5279fb540d5e4878c30c6
Author: sin <sin@2f30.org>
Date: Thu, 2 May 2019 13:48:11 +0100
Free compression context on error
Diffstat:
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/bcompress.c b/bcompress.c
@@ -130,12 +130,13 @@ bcopen(struct bctx *bctx, char *path, int flags, int mode, struct bparam *bpar)
return -1;
}
- if (strcmp(bpar->calgo, "none") == 0)
+ if (strcmp(bpar->calgo, "none") == 0) {
cctx->type = CDNONETYPE;
- else if (strcmp(bpar->calgo, "snappy") == 0)
+ } else if (strcmp(bpar->calgo, "snappy") == 0) {
cctx->type = CDSNAPPYTYPE;
- else {
+ } else {
bops->close(bctx);
+ free(cctx);
return -1;
}
return 0;