r24809: Consolidate the use of temporary talloc contexts.
[samba.git] / source3 / nmbd / nmbd.c
index 9c8c764763c601aab601f057b2f6f8eb8d7d64b0..b9d78a8ba9e0668b52c82dd161e3dd3efa9b2436 100644 (file)
@@ -372,6 +372,7 @@ static void process(void)
 
        while( True ) {
                time_t t = time(NULL);
+               TALLOC_CTX *frame = talloc_stackframe();
 
                /* Check for internal messages */
 
@@ -390,8 +391,10 @@ static void process(void)
                 * (nmbd_packets.c)
                 */
 
-               if(listen_for_packets(run_election))
+               if(listen_for_packets(run_election)) {
+                       TALLOC_FREE(frame);
                        return;
+               }
 
                /*
                 * Handle termination inband.
@@ -583,18 +586,22 @@ static void process(void)
                                                 NULL, MSG_SMB_CONF_UPDATED,
                                                 procid_self(), &blob);
 
-                       if(no_subnets)
+                       if(no_subnets) {
+                               TALLOC_FREE(frame);
                                return;
+                       }
                        reload_after_sighup = 0;
                }
 
                /* check for new network interfaces */
 
-               if(reload_interfaces(t))
+               if(reload_interfaces(t)) {
+                       TALLOC_FREE(frame);
                        return;
+               }
 
                /* free up temp memory */
-                       lp_TALLOC_FREE();
+               TALLOC_FREE(frame);
        }
 }