Added one check for null when creating an internal dictionary
and fixed checking of calloc result.
Changelog:
- rephrased the commit message
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
int cgroup_dictionary_create(struct cgroup_dictionary **dict,
int flags)
{
+ if (!dict)
+ return ECGINVAL;
*dict = (struct cgroup_dictionary *) calloc(
1, sizeof(struct cgroup_dictionary));
- if (!dict) {
+ if (!*dict) {
last_errno = errno;
return ECGOTHER;
}