Author Message

<  Everything Coding  ~  Segfault with freeing active configuration twice

PostPosted: Fri Dec 05, 2014 4:02 pm Reply with quote
Posts: 1 Joined: Fri Dec 05, 2014 3:51 pm

I am trying to use the usb_modeswitch with my Alcatel onetouch X602D
There was a thread here explaining that I have to change the configuration profile.

For me, this triggers a SegFault.

After Relearning C, I think I drilled it down to improper handling of a global variable for the configuration descriptor.
In my case, get_current_configuration() gets called twice in one run. In the first run, the global variable active_config is NULL, but get_current_configuration needs a active_config, so it gets an active_config and stores the pointer in the global variable. At the end of the method, the active_config is freed, but the global variable still points to the same, now freed adress.
On the second run, no get_active_config from libusb gets called, so no new address gets assigned. Now usb_modeswitch tries to free the descriptor again at the end of the method. Here comes the segfault.
There are multiple locations in the code where an active config gets loaded, then freed but the global variable does not get NULLed. I NULLed the variable in the source in this one invocation, now I don't get segfaults any more. Unfortunately I now get the notification that changing the configuration has failed...

PostPosted: Sun Dec 14, 2014 7:48 pm Reply with quote
Site Admin Posts: 6529 Joined: Sat Nov 03, 2007 12:30 am
Thanks for the report - I'll look into it.


Display posts from previous:  Sort by:

All times are UTC+02:00
Page 1 of 1
2 posts
Users browsing this forum: No registered users and 1 guest
Search for:
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum