[CRIU] [PATCH 2/4] autofs: free leaked AutofsEntry in autofs_dump_entry
Stanislav Kinsburskiy
skinsbursky at virtuozzo.com
Thu Mar 24 04:32:09 PDT 2016
Signed-off-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
---
criu/autofs.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/criu/autofs.c b/criu/autofs.c
index 7df2f92..c26f861 100644
--- a/criu/autofs.c
+++ b/criu/autofs.c
@@ -338,16 +338,22 @@ static int autofs_dump_entry(struct mount_info *pm, AutofsEntry *entry)
int autofs_dump(struct mount_info *pm)
{
AutofsEntry *entry;
+ int err;
entry = xmalloc(sizeof(*entry));
if (!entry)
return -1;
autofs_entry__init(entry);
- if (autofs_create_entry(pm, entry))
- return -1;
+ err = autofs_create_entry(pm, entry);
+ if (err)
+ goto free_entry;
+
+ err = autofs_dump_entry(pm, entry);
- return autofs_dump_entry(pm, entry);
+free_entry:
+ free(entry);
+ return err < 0 ? err : 0;
}
typedef struct autofs_info_s {
More information about the CRIU
mailing list