and fixed checking of calloc result.

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;
        }


------------------------------------------------------------------------------
Get a FREE DOWNLOAD! and learn more about uberSVN rich system, 
user administration capabilities and model configuration. Take 
the hassle out of deploying and managing Subversion and the 
tools developers use with it. 
http://p.sf.net/sfu/wandisco-dev2dev
_______________________________________________
Libcg-devel mailing list
Libcg-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to