Fix two resource leaks reported by Coverity tool:
CID
1488718 (#1 of 1): Resource leak (RESOURCE_LEAK) leaked_storage:
Variable handle going out of scope leaks the storage it points to.
CID
1488723 (#1 of 1): Resource leak (RESOURCE_LEAK) leaked_storage:
Variable dir going out of scope leaks the storage it points to.
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
(cherry picked from commit
fea1ab8b45d7bbe708c9fd4e66b4d639fa7aa984)
fp = (FILE *)*handle;
fclose(fp);
+ *handle = NULL;
return 0;
}
cv->multiline_value = NULL;
}
+ if ((FILE *)handle)
+ fclose((FILE *)handle);
+
return ret;
}
}
}
- closedir(dir);
-
out:
+ if (dir)
+ closedir(dir);
+
pthread_rwlock_unlock(&cg_mount_table_lock);
return ret;
}