[pacman-dev] [BUG] alpm_list_remove need an initalized pointer for void **data

solsTiCe d'Hiver solstice.dhiver at gmail.com
Thu Aug 7 11:23:16 EDT 2008

for me it is a problem with alpm_list_remove but i am not an expert. 

look at this
#include <alpm.h>

int compare_int(const void *a, const void *b) {
    const int* ia = (const int *)a;
    const int* ib = (const int *)b;
    return (*ia > *ib) - (*ia < *ib);

int main(void) {
    alpm_list_t *l=NULL;
    int a=2,a2=2;
    l= alpm_list_add(l, &a);
    l= alpm_list_add(l, &a2);
    void **data=NULL;
    l = alpm_list_remove(l, &a, compare_int, data);
    puts("still ok ?");
    void **data2;
    l = alpm_list_remove(l, &a2, compare_int, data2);
    return 0;

it only seg fault at the second alpm_list_remove

More information about the pacman-dev mailing list