Bug 6964 - The mem_limit() function is suspicious
Summary: The mem_limit() function is suspicious
Status: RESOLVED MOVED
Alias: None
Product: Xtests
Classification: Unclassified
Component: XTS (show other bugs)
Version: unspecified
Hardware: x86 (IA32) Linux (All)
: high normal
Assignee: Stuart Anderson
QA Contact: Xorg testing team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-05-18 23:48 UTC by Jiri Dluhos
Modified: 2018-08-10 21:43 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Jiri Dluhos 2006-05-18 23:48:22 UTC
The mem_limit() function, in libXtTest/avs_func.c, is very hard to comprehend,
and I suspect it may be incorrect on Linux because malloc() is not guaranteed to
return NULL when there is not enough memory.

The code looks like this:

size_t
mem_limit()
{
	char	*ptr;
	size_t	hbit,i,j;

	j = 0;
	for (hbit=(((size_t)-1)>>1)+1;hbit;hbit=(ptr)?(i>>1):(i>>2)){
		for(i=1;
			(ptr=malloc(i|j)) && (free(ptr),1) && (i<hbit);
		i<<=1);
			j |= (ptr) ? i : i >> 1;
	}
	return(j);
}
Comment 1 chemtech 2013-03-15 14:07:36 UTC
Jiri Dluhos
Do you still experience this issue with newer drivers ?
Please check the status of your issue.
Comment 2 GitLab Migration User 2018-08-10 21:43:13 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/xorg/test/xts/issues/7.


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.