Project

General

Profile

Actions

Bug #4724

closed

Possible memory leak in _clnt_vc_create_timed()

Added by Marcel Telka over 8 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Low
Assignee:
Category:
lib - userland libraries
Start date:
2014-04-03
Due date:
% Done:

100%

Estimated time:
Difficulty:
Bite-size
Tags:
needs-triage
Gerrit CR:

Description

In a rare case when the first malloc() at line 241 fails and the second malloc() at line 242 succeeds, we will leak ct here in _clnt_vc_create_timed():

241    cl = malloc(sizeof (*cl));
242    ct = malloc(sizeof (*ct));
243    if ((cl == NULL) || (ct == NULL)) {
244        (void) syslog(LOG_ERR, clnt_vc_errstr,
245                clnt_vc_str, __no_mem_str);
246        rpc_createerr.cf_stat = RPC_SYSTEMERROR;
247        rpc_createerr.cf_error.re_errno = errno;
248        rpc_createerr.cf_error.re_terrno = 0;
249        goto err;
250    }

...

367err:
368    if (cl) {
369        if (ct) {
370            if (ct->ct_addr.len)
371                free(ct->ct_addr.buf);
372            free(ct);
373        }
374        free(cl);
375    }
376    return (NULL);
Actions #1

Updated by Marcel Telka over 8 years ago

  • Status changed from In Progress to Pending RTI
Actions #2

Updated by Electric Monk over 8 years ago

  • Status changed from Pending RTI to Closed
  • % Done changed from 0 to 100

git commit dff8cdb7c81be0916631bfe5b4384516b430227f

commit  dff8cdb7c81be0916631bfe5b4384516b430227f
Author: Marcel Telka <marcel.telka@nexenta.com>
Date:   2014-05-01T00:53:37.000Z

    4724 Possible memory leak in _clnt_vc_create_timed()
    Reviewed by: Andy Stormont <AStormont@racktopsystems.com>
    Reviewed by: Dan McDonald <danmcd@omniti.com>
    Approved by: Gordon Ross <gwr@nexenta.com>

Actions

Also available in: Atom PDF