Bug 5513

Summary: Memory leak in get_proc_cpuinfo
Product: liboil Reporter: Sergey Scobich <sergey.scobich>
Component: unknownAssignee: David Schleef <ds>
Status: RESOLVED FIXED QA Contact: David Schleef <ds>
Severity: normal    
Priority: highest    
Version: unspecified   
Hardware: x86 (IA32)   
OS: Windows (All)   
Whiteboard:
i915 platform: i915 features:

Description Sergey Scobich 2006-01-05 21:20:23 UTC
Here is the part of code:

  cpuinfo = malloc(4096);
  if (cpuinfo == NULL) return NULL;

  fd = open("/proc/cpuinfo", O_RDONLY);
  if (fd < 0) return NULL;

if open() failed you need to free() cpuinfo.
It always failing on Windows platform for example.

Is it possible to exclude this function from compilation on Windows platform -
you don't need to call it at all?
Comment 1 David Schleef 2006-01-06 07:29:32 UTC
Yeah, it would be smart to not use this function on !linux.

Checked in a fix for the leak(s).  I'll eventually get to writing better code
for CPU detection on different OS's.  Right now, I think it works.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.