r14226: Fix Coverity bug # 109
[kai/samba-autobuild/.git] / source3 / rpc_server / srv_reg_nt.c
index 33711d0fac91386956c8ecf05d1b461a31ad4dfb..5ac6738b9919995920afc77e41e34c42864a3fb9 100644 (file)
@@ -835,8 +835,10 @@ static WERROR restore_registry_key ( REGISTRY_KEY *krecord, const char *fname )
        /* get the rootkey from the regf file and then load the tree
           via recursive calls */
           
-       if ( !(rootkey = regfio_rootkey( regfile )) )
+       if ( !(rootkey = regfio_rootkey( regfile )) ) {
+               regfio_close( regfile );
                return WERR_REG_FILE_INVALID;
+       }
        
        result = reg_load_tree( regfile, krecord->name, rootkey );