diff options
author | Endi S. Dewata <edewata@redhat.com> | 2010-07-18 17:28:38 -0500 |
---|---|---|
committer | Noriko Hosoi <nhosoi@redhat.com> | 2010-08-20 13:04:47 -0700 |
commit | 119628c030e209ba342b83914b76eeb1fbcd2dd4 (patch) | |
tree | 4e7a2bdbd4f92fb9b83ed8cd78275a4b79236c5f /ldap/servers | |
parent | 759378748cb944dbfbc90da867d27d170a20d8ee (diff) | |
download | ds-119628c030e209ba342b83914b76eeb1fbcd2dd4.tar.gz ds-119628c030e209ba342b83914b76eeb1fbcd2dd4.tar.xz ds-119628c030e209ba342b83914b76eeb1fbcd2dd4.zip |
Bug 616500 - fix coverify Defect Type: Resource leaks issues CID 12094 - 12136
https://bugzilla.redhat.com/show_bug.cgi?id=616500
Resolves: bug 616500
Bug description: fix coverify Defect Type: Resource leaks issues CID 12116
description: Fixed resource leaks in scalab01_addLogin().
Diffstat (limited to 'ldap/servers')
-rw-r--r-- | ldap/servers/slapd/tools/ldclt/scalab01.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/ldap/servers/slapd/tools/ldclt/scalab01.c b/ldap/servers/slapd/tools/ldclt/scalab01.c index 595df0ff..397099aa 100644 --- a/ldap/servers/slapd/tools/ldclt/scalab01.c +++ b/ldap/servers/slapd/tools/ldclt/scalab01.c @@ -416,11 +416,19 @@ scalab01_addLogin ( int ret; /* Return value */ isp_user *new; /* New entry */ isp_user *cur; /* Current entry */ + int rc = 0; /* * Create the new record. */ new = (isp_user *) malloc (sizeof (isp_user)); + if (NULL == new) { + fprintf (stderr, "ldclt[%d]: %s: cannot malloc(isp_user), error=%d (%s)\n", + mctx.pid, tttctx->thrdId, errno, strerror (errno)); + fflush (stderr); + return -1; + } + strcpy (new->dn, dn); new->cost = new->counter = duration; new->next = NULL; @@ -435,7 +443,8 @@ scalab01_addLogin ( fprintf (stderr, "ldclt[%d]: %s: cannot mutex_lock(), error=%d (%s)\n", mctx.pid, tttctx->thrdId, ret, strerror (ret)); fflush (stderr); - return (-1); + rc = -1; + goto error; } /* @@ -476,6 +485,12 @@ scalab01_addLogin ( } } + goto done; + +error: + if (new) free(new); + +done: /* * Free mutex */ @@ -484,10 +499,10 @@ scalab01_addLogin ( fprintf (stderr, "ldclt[%d]: %s: cannot mutex_unlock(), error=%d (%s)\n", mctx.pid, tttctx->thrdId, ret, strerror (ret)); fflush (stderr); - return (-1); + rc = -1; } - return (0); + return rc; } |