r20209: Fix two memleaks
authorVolker Lendecke <vlendec@samba.org>
Sat, 16 Dec 2006 09:33:17 +0000 (09:33 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:16:32 +0000 (12:16 -0500)
(This used to be commit 92bc870768a2ff839b3b10897a4f09a3ece92704)

source3/registry/reg_eventlog.c

index ea2b274f88a119d53eba9c626fcfd10021ba5c13..90d9a244376275d864ca64efe618ec74647b31fb 100644 (file)
@@ -48,8 +48,10 @@ BOOL eventlog_init_keys( void )
                }
                regdb_fetch_keys( KEY_EVENTLOG, subkeys );
                regsubkey_ctr_addkey( subkeys, *elogs );
-               if ( !regdb_store_keys( KEY_EVENTLOG, subkeys ) )
+               if ( !regdb_store_keys( KEY_EVENTLOG, subkeys ) ) {
+                       TALLOC_FREE(subkeys);
                        return False;
+               }
                TALLOC_FREE( subkeys );
 
                /* add in the key of form KEY_EVENTLOG/Application */
@@ -70,8 +72,10 @@ BOOL eventlog_init_keys( void )
                regdb_fetch_keys( evtlogpath, subkeys );
                regsubkey_ctr_addkey( subkeys, *elogs );
 
-               if ( !regdb_store_keys( evtlogpath, subkeys ) )
+               if ( !regdb_store_keys( evtlogpath, subkeys ) ) {
+                       TALLOC_FREE(subkeys);
                        return False;
+               }
                TALLOC_FREE( subkeys );
 
                /* now add the values to the KEY_EVENTLOG/Application form key */
@@ -287,8 +291,7 @@ BOOL eventlog_add_source( const char *eventlog, const char *sourcename,
                         sourcename ) );
        }
        TALLOC_FREE( values );
-       if ( wrklist )
-               TALLOC_FREE( wrklist ); /*  */
+       TALLOC_FREE( wrklist ); /*  */
 
        if ( !( subkeys = TALLOC_ZERO_P( NULL, REGSUBKEY_CTR ) ) ) {
                DEBUG( 0, ( "talloc() failure!\n" ) );