diff options
author | Nathan Kinder <nkinder@redhat.com> | 2010-09-17 13:31:56 -0700 |
---|---|---|
committer | Nathan Kinder <nkinder@redhat.com> | 2010-09-17 13:31:56 -0700 |
commit | e1702b5a0442013d829eb6e1f4a4c1b7eeb71516 (patch) | |
tree | 37a28b77d9c2533dca8cfa618dd019bbe76276e9 /ldap/servers/slapd | |
parent | 2af08b37e8bcebb68ad85c8cc6195f8f6d3403f1 (diff) | |
download | ds-e1702b5a0442013d829eb6e1f4a4c1b7eeb71516.tar.gz ds-e1702b5a0442013d829eb6e1f4a4c1b7eeb71516.tar.xz ds-e1702b5a0442013d829eb6e1f4a4c1b7eeb71516.zip |
Bug 630092 - (cov#12116) Resource leak in ldclt code
There is a chance that we leak the memory pointed to by the new
variable if we never have one of the ldclt contexts point to it.
We need to jump to the error label in this case to free the memory.
Diffstat (limited to 'ldap/servers/slapd')
-rw-r--r-- | ldap/servers/slapd/tools/ldclt/scalab01.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/ldap/servers/slapd/tools/ldclt/scalab01.c b/ldap/servers/slapd/tools/ldclt/scalab01.c index c0437b08..39345bd1 100644 --- a/ldap/servers/slapd/tools/ldclt/scalab01.c +++ b/ldap/servers/slapd/tools/ldclt/scalab01.c @@ -465,6 +465,13 @@ scalab01_addLogin ( else { cur = s1ctx.list; + + /* If cur is NULL, we should just bail and free new. */ + if (cur == NULL) + { + goto error; + } + while (cur != NULL) { if (cur->next == NULL) @@ -472,15 +479,16 @@ scalab01_addLogin ( cur->next = new; cur = NULL; /* Exit loop */ } - else - if (cur->next->counter >= duration) - { + else if (cur->next->counter >= duration) + { new->next = cur->next; cur->next = new; cur = NULL; /* Exit loop */ - } - else + } + else + { cur = cur->next; + } } } } |