Closed Bug 505723 Opened 11 years ago Closed 11 years ago

nsWifiMonitor::DoScan seems to leak iwlib_handle after ReplaceArray(lastAccessPoints, accessPoints)

Categories

(Core :: Networking, defect, minor)

x86
Linux
defect
Not set
minor

Tracking

()

RESOLVED FIXED

People

(Reporter: timeless, Assigned: timeless)

References

(Blocks 1 open bug, )

Details

(Keywords: coverity, memory-leak)

Attachments

(1 file, 2 obsolete files)

130  	nsWifiMonitor::DoScan()
132  	  void* iwlib_handle = dlopen("libiw.so", RTLD_NOW);
148  	  if (!iw_open || !iw_enum || !iw_stats) {
149  	    dlclose(iwlib_handle);

156  	  if (skfd < 0) {
157  	    dlclose(iwlib_handle);

186  	    ReplaceArray(lastAccessPoints, accessPoints);
191  	      nsIWifiAccessPoint** result = static_cast<nsIWifiAccessPoint**> (nsMemory::Alloc(sizeof(nsIWifiAccessPoint*) * resultCount));
192  	      if (!result)
193  	        return NS_ERROR_OUT_OF_MEMORY;

229  	  iw_sockets_close(skfd);
231  	  return NS_OK;
Attached patch patch (obsolete) — Splinter Review
Assignee: nobody → timeless
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Attachment #390131 - Flags: review?(doug.turner)
Comment on attachment 390131 [details] [diff] [review]
patch

got tabs in the patch, but otherwise fine.
Attachment #390131 - Flags: review?(doug.turner) → review+
Comment on attachment 390131 [details] [diff] [review]
patch

iw_stats is used elsewhere in this file.
Attachment #390131 - Flags: review+ → review-
Attached patch patch for build bustage? (obsolete) — Splinter Review
josh, you could try something like this?
Attached patch yeahSplinter Review
yeah, that makes sense.

for reference, the reason i moved those things out of global scope is that if you load/unload libraries, you *really* don't want stale pointers floating around.
Attachment #390131 - Attachment is obsolete: true
Attachment #390147 - Attachment is obsolete: true
Attachment #390172 - Flags: review?(doug.turner)
Attachment #390172 - Flags: review?(doug.turner) → review+
http://hg.mozilla.org/mozilla-central/rev/6e0c9450ac68
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.