[EMAIL PROTECTED] wrote:
> I found memory leak(?) of 1 byte when PEAP authentication, by valgrind.

  Can you provide a test case, hopefully with wpa_supplicant as the client?

> I tried fllowing patch for rlm_eap.
> it look like work well.
> is it corret way?

  I'm not sure.  The "type.data" field *is* malloc'd.  It is NOT free'd
in eap_packet_free().  However, it *is* free'd in eap_wireformat().

  The only time I can see there being a memory leak is when the EAP
packet is allocated, *but* it is never encoded into the wire-format.

  If you go to the rlm_eap directory, you can do:

$  grep -r alloc . | grep type.data | grep c:

  That will give you around 10 locations where type.data = malloc(...).
If this is really a memory leak, then *all* of those locations will
likely have to be fixed.

  The following change inside of eap_packet_free() *should* catch all
corner cases.

  Alan DeKok.

        if (eap_packet->type.data) {
                /*
                 *      There IS a packet, AND the data portion points
                 *      to the EAP data: do nothing.  Otherwise, free it.
                 */
                if (!(eap_packet->packet &&
                      (eap_packet->type.data == (eap_packet->packet + 5)))) {
                        free(eap_packet->type.data);
                }
                eap_packet->type.data = NULL;
        }

-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html

Reply via email to