Linux bluetooth development
 help / color / mirror / Atom feed
From: "Daryl Van Vorst" <daryl@wideray.com>
To: "'BlueZ Mailing List'" <bluez-devel@lists.sourceforge.net>
Subject: [Bluez-devel] Cleaning up after sdp_get_access_protos()
Date: Fri, 25 Feb 2005 16:51:22 -0800	[thread overview]
Message-ID: <001401c51b9d$4c81af30$1a01010a@baked> (raw)

Hi,

This stuff hurts my brain, so I was hoping someone (Marcel? ;) could =
verify
my logic.

I'm mentioning this mostly because the utils code gets used as example =
code.

In this snippet from sdptool.c, proto is cleaned up with
sdp_list_free(proto, (sdp_free_func_t)sdp_data_free);

        if (sdp_get_access_protos(rec, &proto) =3D=3D 0) {
                printf("Protocol Descriptor List:\n");
                sdp_list_foreach(proto, print_access_protos, 0);
                sdp_list_free(proto, (sdp_free_func_t)sdp_data_free);
        }

I think the cleanup should be:

    sdp_list_foreach(proto,(sdp_list_func_t)sdp_list_free,0);
    sdp_list_free(proto,0);

Looking at sdp.c source (in libs), sdp_get_access_protos() returns a =
list of
lists of data sequences. The data sequences themselves shouldn't be =
freed at
this point because they weren't allocated by sdp_get_access_protos() =
(thus
the ,0 in the sdp_list_foreach call). But the list of lists is allocated
inside sdp_get_access_protos().

-Daryl.



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

             reply	other threads:[~2005-02-26  0:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-26  0:51 Daryl Van Vorst [this message]
2005-02-28  8:32 ` [Bluez-devel] Cleaning up after sdp_get_access_protos() Marcel Holtmann
2005-02-28 11:59   ` Stephen Crane

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='001401c51b9d$4c81af30$1a01010a@baked' \
    --to=daryl@wideray.com \
    --cc=bluez-devel@lists.sourceforge.net \
    /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