From 83fb6144629d385a4dd1b8cbc3ea633abfdf33ec Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Fri, 9 Oct 2015 11:03:38 +0200 Subject: [PATCH] Closed memory leak in (improbable) case of error when attaching AAIP attributes to IsoNode. Coverity CID 12564. --- libisofs/node.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libisofs/node.c b/libisofs/node.c index 76fd705..1ecc916 100644 --- a/libisofs/node.c +++ b/libisofs/node.c @@ -1958,7 +1958,7 @@ int iso_node_set_attrs(IsoNode *node, size_t num_attrs, char **names, { int ret, acl_saved = 0; size_t sret, result_len, m_num = 0, *m_value_lengths = NULL, i; - unsigned char *result; + unsigned char *result = NULL; char *a_acl = NULL, *d_acl = NULL, **m_names = NULL, **m_values = NULL; if (!(flag & 8)) @@ -2003,8 +2003,11 @@ int iso_node_set_attrs(IsoNode *node, size_t num_attrs, char **names, } ret = iso_node_remove_xinfo(node, aaip_xinfo_func); - if (ret < 0) + if (ret < 0) { + if (result != NULL) + free(result); goto ex; + } ret = iso_node_add_xinfo(node, aaip_xinfo_func, result); if (ret < 0) goto ex;