Re: Patch for DAAP Plugin

Stephen Huenneke <[email protected]>
Newsgroups gmane.comp.gnome.apps.rhythmbox.devel
Message-ID <[email protected]>
Just because I'm curious now, would this patch fix the problems you
pointed out in my previous submission:

diff --git a/plugins/daap/rb-daap-plugin.c b/plugins/daap/rb-daap-plugin.c
index 20cc539..28a88b0 100644
--- a/plugins/daap/rb-daap-plugin.c
+++ b/plugins/daap/rb-daap-plugin.c
@@ -643,11 +643,13 @@ new_daap_share_location_added_cb (RBURIDialog *dialog,
        int port = 3689;
        DMAPMdnsBrowserService service;

-       host = g_strdup (location);
-       p = strrchr (host, ':');
+       p = strrchr (location, ':');
        if (p != NULL) {
+               host = g_strndup (location, p-location);
                port = strtoul (p+1, NULL, 10);
                *p = '\0';
+       } else {
+               host = g_strdup (location);
        }

        rb_debug ("adding manually specified DAAP share at %s", location);

On Tue, May 3, 2011 at 7:37 AM, Bastien Nocera <[email protected]> wrote:
> On Tue, 2011-05-03 at 07:15 -0400, Stephen Huenneke wrote:
>> Sorry, I'm not much of a c developer, I was just trying to be helpful
>> and give you folks more info than just a complaint. Does the bug,
>> ignoring my bad patch, seem legitimate?
>
> File a bug please, yes.
>
>> On May 3, 2011 7:11 AM, "Bastien Nocera" <[email protected]> wrote:
>> > On Mon, 2011-05-02 at 16:58 -0400, Stephen Huenneke wrote:
>> >>
>> >> diff --git a/plugins/daap/rb-daap-plugin.c
>> >> b/plugins/daap/rb-daap-plugin.c
>> >> index 20cc539..fc72ac0 100644
>> >> --- a/plugins/daap/rb-daap-plugin.c
>> >> +++ b/plugins/daap/rb-daap-plugin.c
>> >> @@ -646,6 +646,7 @@ new_daap_share_location_added_cb (RBURIDialog
>> >> *dialog,
>> >> host = g_strdup (location);
>> >> p = strrchr (host, ':');
>> >> if (p != NULL) {
>> >> + host = g_strndup (location, p);
>> >
>> >
>> > That should probably be "p - location", instead of "p", and you're
>> > leaking the host as well.
>> >
>> >> port = strtoul (p+1, NULL, 10);
>> >> *p = '\0';
>> >> }
>> >>
>> >>
>> >
>>
>
>
>



-- 
///Stephen - http://sdh.skarilla.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.