Fix a resource leak, reported by Coverity tool:
CID 258274 (#1 of 1): Resource leak (RESOURCE_LEAK)6. leaked_storage:
Variable handle going out of scope leaks the storage it points to
In read_setting(), currently, we goto end label, on the failure of
strdup() before closing the handle, leaking the resource. Fix it by
removing the goto, that allows the code flow to close the handle and
execute the code under the end label.
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
goto end;
*value = strdup(tmp_line);
- if ((*value) == NULL) {
+ if ((*value) == NULL)
ret = ECGOTHER;
- goto end;
- }
read_end:
cgroup_read_value_end(&handle);