From: Tracker i. u. n. <pup...@li...> - 2012-02-26 04:08:38
|
Bugs item #3489999, was opened at 2012-02-21 07:06 Message generated for change (Comment added) made by mroberto You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=841026&aid=3489999&group_id=166957 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: upnp Group: None >Status: Pending Resolution: Accepted Priority: 5 Private: No Submitted By: Yoichi NAKAYAMA (yoichi) Assigned to: Marcelo Roberto Jimenez (mroberto) Summary: UpnpString leaks in genaSubscribe() Initial Comment: In genaSubscribe() (defined in upnp/src/gena/gena_ctrlpt.c), ActualSID and EventURL will not be freed if ScheduleGenaAutoRenew returns UPNP_E_SUCCESS. ---------------------------------------------------------------------- >Comment By: Marcelo Roberto Jimenez (mroberto) Date: 2012-02-25 20:08 Message: Hi Yoichi, I agree, there has been a confusion there, you caught a bug. I will remove the test. Thanks! Regards, Marcelo. ---------------------------------------------------------------------- Comment By: Yoichi NAKAYAMA (yoichi) Date: 2012-02-25 04:56 Message: Not the same issue. I'm sorry I did not mention the version I'm using. I found the issue in libupnp-1.6.15. Detailed explanation follows: --- "a/C:\\Users\\yoichi\\Downloads\\libupnp-1.6.15\\upnp\\src\\gena\\gena_ctrlpt.c.orig" +++ "b/C:\\Users\\yoichi\\Downloads\\libupnp-1.6.15\\upnp\\src\\gena\\gena_ctrlpt.c" @@ -509,8 +509,8 @@ int genaSubscribe( uuid_upnp uid; Upnp_SID temp_sid; Upnp_SID temp_sid2; - UpnpString *ActualSID = UpnpString_new(); - UpnpString *EventURL = UpnpString_new(); + UpnpString *ActualSID = UpnpString_new(); // allocate UpnpString and assign to local variable + UpnpString *EventURL = UpnpString_new(); // allocate UpnpString and assign to local variable struct Handle_Info *handle_info; UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__, "GENA SUBSCRIBE BEGIN"); @@ -528,7 +528,7 @@ int genaSubscribe( /* subscribe */ SubscribeLock(); - return_code = gena_subscribe(PublisherURL, TimeOut, NULL, ActualSID); + return_code = gena_subscribe(PublisherURL, TimeOut, NULL, ActualSID); // alter ActualSID HandleLock(); if (return_code != UPNP_E_SUCCESS) { UpnpPrintf( UPNP_CRITICAL, GENA, __FILE__, __LINE__, @@ -549,7 +549,7 @@ int genaSubscribe( UpnpString_set_String(out_sid, temp_sid2); /* create event url */ - UpnpString_assign(EventURL, PublisherURL); + UpnpString_assign(EventURL, PublisherURL); // alter EventURL /* fill subscription */ if (newSubscription == NULL) { @@ -558,8 +558,8 @@ int genaSubscribe( } UpnpClientSubscription_set_RenewEventId(newSubscription, -1); UpnpClientSubscription_set_SID(newSubscription, out_sid); - UpnpClientSubscription_set_ActualSID(newSubscription, ActualSID); - UpnpClientSubscription_set_EventURL(newSubscription, EventURL); + UpnpClientSubscription_set_ActualSID(newSubscription, ActualSID); // duplicate and set newer one to newSubscription + UpnpClientSubscription_set_EventURL(newSubscription, EventURL); // duplicate and set newer one to newSubscription UpnpClientSubscription_set_Next(newSubscription, handle_info->ClientSubList); handle_info->ClientSubList = newSubscription; @@ -567,7 +567,7 @@ int genaSubscribe( return_code = ScheduleGenaAutoRenew(client_handle, *TimeOut, newSubscription); error_handler: - if (return_code != UPNP_E_SUCCESS) { + if (return_code != UPNP_E_SUCCESS) { // ActualSID and EventURL is not freed if the condition is false UpnpString_delete(ActualSID); UpnpString_delete(EventURL); UpnpClientSubscription_delete(newSubscription); @@ -575,7 +575,7 @@ error_handler: HandleUnlock(); SubscribeUnlock(); - return return_code; + return return_code; // go out of the scope of local variables } #endif /* INCLUDE_CLIENT_APIS */ ---------------------------------------------------------------------- Comment By: Marcelo Roberto Jimenez (mroberto) Date: 2012-02-23 10:38 Message: Hi Yoichi, I believe that what you report is the desired behavior. On the other hand, there is indeed a memory leak in this function on line 525, if the function returns GENA_E_BAD_HANDLE. Maybe this is the issue you are observing, what do you think? I have fixed the memleak, tell me what behavior do you see now. Regards, Marcelo. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=841026&aid=3489999&group_id=166957 |