tFix free calls - dedup - deduplicating backup program
(HTM) git clone git://git.z3bra.org/dedup.git
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit b96d7bbaecdf4fc5f4555456b7eec9d6ca895a9a
(DIR) parent b3f176118aa23e15a340ee20f4758175a64c9240
(HTM) Author: sin <sin@2f30.org>
Date: Sat, 13 Jul 2019 01:24:52 +0100
Fix free calls
Diffstat:
M snap.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
---
(DIR) diff --git a/snap.c b/snap.c
t@@ -321,7 +321,7 @@ sopen(char *path, int flags, int mode, struct sctx **sctx)
shdr = &(*sctx)->shdr;
if (xread(fd, buf, SHDRSIZE) != SHDRSIZE) {
- free(sctx);
+ free(*sctx);
close(fd);
seterr("failed to read snapshot header: %s", strerror(errno));
return -1;
t@@ -329,7 +329,7 @@ sopen(char *path, int flags, int mode, struct sctx **sctx)
unpackshdr(buf, shdr);
if (memcmp(shdr->magic, SHDRMAGIC, NSHDRMAGIC) != 0) {
- free(sctx);
+ free(*sctx);
close(fd);
seterr("unknown snapshot header magic");
return -1;
t@@ -337,7 +337,7 @@ sopen(char *path, int flags, int mode, struct sctx **sctx)
/* If the major version is different, the format is incompatible */
if (((shdr->flags >> VMAJSHIFT) & VMAJMASK) != VMAJ) {
- free(sctx);
+ free(*sctx);
close(fd);
seterr("snapshot header version mismatch");
return -1;