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 <jsafr...@redhat.com>
---

 src/api.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/api.c b/src/api.c
index e0ed696..207d076 100644
--- a/src/api.c
+++ b/src/api.c
@@ -3946,10 +3946,12 @@ int cgroup_get_procs(char *name, char *controller, 
pid_t **pids, int *size)
 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;
        }


------------------------------------------------------------------------------
EMC VNX: the world's simplest storage, starting under $10K
The only unified storage solution that offers unified management 
Up to 160% more powerful than alternatives and 25% more efficient. 
Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev
_______________________________________________
Libcg-devel mailing list
Libcg-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to