bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

hash vs. xmalloc [was: [PATCH 2/2] tests: drop unused link dependency]


From: Eric Blake
Subject: hash vs. xmalloc [was: [PATCH 2/2] tests: drop unused link dependency]
Date: Wed, 27 Apr 2011 15:26:52 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.15) Gecko/20110307 Fedora/3.1.9-0.39.b3pre.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.9

On 04/27/2011 12:24 AM, Jim Meyering wrote:
>> fdutimensat-tests still pulls in xalloc, via utimecmp (which
>> calls xalloc_die if it can't manage a hash table).  So this
>> patch isn't quite perfect yet, but getting closer.  Any ideas
>> on whether it would be possible to make utimecmp work without
>> xalloc?
> 
> Looks feasible.
> The hash table is solely to avoid incurring the cost of calculating
> the time stamp resolution for every call.  The alternative is simply
> to incur the cost when hash table initialization or insertion fails.

Even worse, I just noticed that there is a NULL dereference on low
memory conditions in utimecmp.  The code tries to allocate ht, but then
blindly uses ht even if allocation failed.

I definitely agree that utimecmp's use of a hash-table is merely a
caching optimization, and therefore memory failure should not be fatal.
 I'll have a patch shortly...

-- 
Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]