public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Stefan Mischke <StefanMischke@web.de>
To: Marcel Holtmann <marcel@holtmann.org>
Cc: BlueZ Mailing List <bluez-devel@lists.sourceforge.net>,
	"Stefan Mischke (E-Mail)" <survivor@upb.de>
Subject: Re: [Bluez-devel] SDP memory leak?
Date: Fri, 27 Aug 2004 15:24:41 +0200	[thread overview]
Message-ID: <412F3619.40202@web.de> (raw)
In-Reply-To: <1093610969.2581.119.camel@pegasus>

Hi!

Marcel Holtmann schrieb:

>no, I think you are right. I expect more memory leaks in the SDP code.
>We need some people to check this and send me patches.
>  
>
Well then, I just figured out (in my own TestApp based on 
"bnep_sdp_search()") that it simply doesn't work like this. I propose to 
do "sdp_close()" as the last sdp_* call (as in the code below). Same 
with dund. So there might be no memory leak but an illegal pointer 
access. One has to correct "pand/sdp.c" and "dund/sdp.c".

Regards
Stefan

<CODE>

int bnep_sdp_search(bdaddr_t *src, bdaddr_t *dst, uint16_t service)
{
    sdp_list_t *srch, *rsp = NULL;
    sdp_session_t *s;
    uuid_t svclass;
    int err, res;

    switch (service) {
    case BNEP_SVC_PANU:
        sdp_uuid16_create(&svclass, PANU_SVCLASS_ID);
        break;
    case BNEP_SVC_NAP:
        sdp_uuid16_create(&svclass, NAP_SVCLASS_ID);
        break;
    case BNEP_SVC_GN:
        sdp_uuid16_create(&svclass, GN_SVCLASS_ID);
        break;
    }
       
    srch = sdp_list_append(NULL, &svclass);

    s = sdp_connect(src, dst, 0);
    if (!s) {
        syslog(LOG_ERR, "Failed to connect to the SDP server. %s(%d)",
                strerror(errno), errno);
        return 0;
    }

    err = sdp_service_search_req(s, srch, 1, &rsp);
    res = sdp_list_len(rsp);
    sdp_close(s);

    /* Assume that search is successeful
     * if at least one record is found */
    if (!err && res)
        return 1;

    return 0;
}

</CODE>

  reply	other threads:[~2004-08-27 13:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-27 12:32 [Bluez-devel] SDP memory leak? Stefan Mischke
2004-08-27 12:49 ` Marcel Holtmann
2004-08-27 13:24   ` Stefan Mischke [this message]
2004-08-27 13:28     ` Marcel Holtmann
2004-08-27 13:31   ` Stephen Crane
2004-08-27 13:34     ` Marcel Holtmann
2004-08-27 14:40       ` Stephen Crane
2004-08-27 17:26         ` Marcel Holtmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=412F3619.40202@web.de \
    --to=stefanmischke@web.de \
    --cc=bluez-devel@lists.sourceforge.net \
    --cc=marcel@holtmann.org \
    --cc=survivor@upb.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox