Commit c48099d8 authored by Pavel Emelyanov's avatar Pavel Emelyanov

image: Introduce collect-nofree flag

Current collect helper frees the pb entry if there's
zero priv_size on cinfo. For files we'll have zero
priv_size (as entries will be collected by sub-cinfos),
while the entry in question should NOT be freed.
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent 80e146da
...@@ -36,6 +36,7 @@ struct collect_image_info { ...@@ -36,6 +36,7 @@ struct collect_image_info {
}; };
#define COLLECT_SHARED 0x1 /* use shared memory for obj-s */ #define COLLECT_SHARED 0x1 /* use shared memory for obj-s */
#define COLLECT_NOFREE 0x2 /* don't free entry after callback */
#define COLLECT_HAPPENED 0x4 /* image was opened and collected */ #define COLLECT_HAPPENED 0x4 /* image was opened and collected */
extern int collect_image(struct collect_image_info *); extern int collect_image(struct collect_image_info *);
......
...@@ -217,7 +217,7 @@ int collect_image(struct collect_image_info *cinfo) ...@@ -217,7 +217,7 @@ int collect_image(struct collect_image_info *cinfo)
break; break;
} }
if (!cinfo->priv_size) if (!cinfo->priv_size && !(cinfo->flags & COLLECT_NOFREE))
cr_pb_descs[cinfo->pb_type].free(msg, NULL); cr_pb_descs[cinfo->pb_type].free(msg, NULL);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment