Skip to content

Segfault on search when user data for the callback is not given #1

@valentindavid

Description

@valentindavid

When no user data is given for the callback of a search query, then there can happen a segfault. I propose a patch. But it is to be noted that:

  1. If the user does not give a user data parameter, then its callback should not have a parameter for it. But I think it makes sense like that. This is a change in the API, but the users will have their code failing with a nice error telling them there is a parameter too many on their callback.
  2. Looking at the code, there are lots of memory leaks. This is specially a problem for programs which run as daemon. For instance, the two pointers callback and userdata are not decremented for the GC, and the struct containing the pointers is not deallocated. This patch does not address this problem. You should think of using valgrind to hunt those leaks.

I do not know how to attach a file on github:
http://www.valentindavid.com/files/pyspotify-master-segfault_on_search.patch

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions