Audit usage of get_dyn_STATEDIR() and replace with state_path()
authorSteven Danneman <steven.danneman@isilon.com>
Mon, 12 Jan 2009 06:44:10 +0000 (22:44 -0800)
committerSteven Danneman <steven.danneman@isilon.com>
Tue, 13 Jan 2009 01:46:14 +0000 (17:46 -0800)
The state directory is now run-time configurable through loadparm, so all
references to it should be done through state_path() or lp_statedir().

source3/nmbd/nmbd_winsserver.c

index 74bed684fdd24e5e5a203d5ebebe64e96a74190d..70118063b40828664cc801befeac45293ddd2308 100644 (file)
@@ -2366,7 +2366,7 @@ void wins_write_database(time_t t, bool background)
                }
        }
 
-       if (asprintf(&fname, "%s/%s", get_dyn_STATEDIR(), WINS_LIST) < 0) {
+       if (!(fname = state_path(WINS_LIST))) {
                goto err_exit;
        }
        /* This is safe as the 0 length means "don't expand". */
@@ -2394,8 +2394,8 @@ void wins_write_database(time_t t, bool background)
 
   err_exit:
 
-       SAFE_FREE(fname);
        SAFE_FREE(fnamenew);
+       /* fname is talloced and doesn't need to be freed */
 
        if (background) {
                _exit(0);