reconnect: collect mallocs/frees of the previous reconnection

Signed-off-by: wanghonghao <wanghonghao@bytedance.com>
This commit is contained in:
wanghonghao
2020-04-06 21:08:34 +08:00
parent 843a01cbd8
commit 0659c74302

View File

@@ -463,6 +463,9 @@ int iscsi_reconnect(struct iscsi_context *iscsi)
iscsi_free(iscsi, iscsi->smalloc_ptrs[i]);
}
iscsi_free(iscsi, iscsi->opaque);
iscsi->old_iscsi->mallocs += iscsi->mallocs;
iscsi->old_iscsi->frees += iscsi->frees;
tmp_iscsi->old_iscsi = iscsi->old_iscsi;
} else {
tmp_iscsi->old_iscsi = malloc(sizeof(struct iscsi_context));