On Jun 14, 2012, at 6:49 AM, Rajasekhar wrote:

> The rpm version we are using is 4.8 and platform is RHEL6 and the
> valgrind output is attached. This issue we are observing only we have
> two kernels already installed  already on the machine and with one
> kernel the transaction going just fine .
> 
> 

This is where the problem is:

==21323== 1 errors in context 2 of 214:                                         
                                                                             
==21323== Invalid read of size 8                                                
                                                                             
==21323==    at 0x33222177FA: findEntry (header.c:706)                          
                                                                             
==21323==    by 0x3322219BB2: intGetTdEntry (header.c:1300)                     
                                                                             
==21323==    by 0x33222175BA: headerGet (header.c:1337)                         
                                                                             
==21323==    by 0x4C488E3: headerGetEntryWrapper (rc-rpmman.c:3302)             
                                                                             
==21323==    by 0x4C495E8: rc_rpmman_read_header (rc-rpmman.c:1882)             
                                                                             
==21323==    by 0x4C4C10D: rc_rpmman_query (rc-rpmman.c:2321)                   
                                                                             
==21323==    by 0x4C4DEE6: rc_rpmman_transact (rc-rpmman.c:1333)                
                                                                             
==21323==    by 0x4033ED: ??? (in /opt/novell/zenworks/lib/zmd/transact)        
                                                                             
==21323==    by 0x4038E2: main (in /opt/novell/zenworks/lib/zmd/transact)       
                                                                             
==21323==  Address 0x507cf98 is 8 bytes inside a block of size 40 free'd        
                                                                             
==21323==    at 0x4A04D72: free (vg_replace_malloc.c:325)                       
                                                                             
==21323==    by 0x3322618438: rfree (rpmmalloc.c:78)                            
                                                                             
==21323==    by 0x332221DC83: miFreeHeader (rpmdb.c:1541)                       
                                                                             
==21323==    by 0x332221E9AD: rpmdbNextIterator (rpmdb.c:2064)                  
                                                                             
==21323==    by 0x4C4BC59: rc_rpmman_find_system_headers (rc-rpmman.c:713)      
  
-----------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                                                           
==21323==    by 0x4C4C0C6: rc_rpmman_query (rc-rpmman.c:2312)                   
                                                                             
==21323==    by 0x4C4DEE6: rc_rpmman_transact (rc-rpmman.c:1333)                
                                                                             
==21323==    by 0x4033ED: ??? (in /opt/novell/zenworks/lib/zmd/transact)        
                                                                             
==21323==    by 0x4038E2: main (in /opt/novell/zenworks/lib/zmd/transact)       
                                        

The Header object returned from rpmdbNextIterator is refcounted data.

You are (likely, I can't see the code) using the header object outside the
scope of an iterator.

Make sure that you do something like
         myheader = headerLink(h);
if you want to use a header outside of the scope of an iterator.

You walso need to release the reference somewhere
        (void) headerFree(myheader);
or you WILL have a memory leak.

Note that all data retrieved through headerGet() implicitly relies
on the reference count of the underlying header: the pointers
to header tag data are all within the header object.

hth

73 de Jeff
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
Developer Communication List                        rpm-devel@rpm5.org

Reply via email to