[interfacekit] Bug in Syscursor code

I think I just found a bug in SysCursor code:

const char *CursorSet::GetName(void)
 {
        BString name;
        if(FindString("name",&name)==B_OK)
                return name.String();
        return NULL;
 }


That code isn't right, since as soon as the function returns, the buffer 
allocated by the BString object
will be freed, and name.String() will be no longer valid.

A nicer  solution can be:

const char *CursorSet::GetName(void)
 {
        const char *name = NULL;
        if(FindString("name", &name) == B_OK)
                return name;
        return NULL;
 }


P.S: This kind of bug is very common (and not so easy to notice, since you can 
get various results), so maybe everyone (me included :PP) can go over their 
code to make sure they don't make the same mistake. 


Other related posts: