move to SAFE_FREE()
authorSimo Sorce <idra@samba.org>
Mon, 17 Sep 2001 11:48:29 +0000 (11:48 +0000)
committerSimo Sorce <idra@samba.org>
Mon, 17 Sep 2001 11:48:29 +0000 (11:48 +0000)
(This used to be commit 67db8f03c5c9e81e11b5f3276b50ee23e09a2659)

source3/utils/make_printerdef.c
source3/utils/nmblookup.c
source3/utils/smbcacls.c
source3/utils/smbpasswd.c
source3/utils/smbtree.c
source3/web/cgi.c
source3/web/diagnose.c

index bfbf6fa4995e3a46e77de665af1057cbf4f32373..47589984ccb676c89be251e1fdbf832bfc8ede77 100644 (file)
@@ -154,8 +154,8 @@ static void lookup_strings(FILE *fichier)
   temp2=(char *)malloc(sizeof(pstring));
   
   if(temp == NULL || temp2 == NULL) {
-         safe_free(temp);
-         safe_free(temp2);
+         SAFE_FREE(temp);
+         SAFE_FREE(temp2);
     fprintf(stderr,"lookup_strings: malloc fail !\n");
     exit(1);
   }
@@ -218,8 +218,8 @@ static void lookup_entry(FILE *fichier,char *chaine)
   temp2=(char *)malloc(sizeof(pstring));
   
   if(temp == NULL || temp2 == NULL) {
-         safe_free(temp);
-         safe_free(temp2);
+         SAFE_FREE(temp);
+         SAFE_FREE(temp2);
     fprintf(stderr,"lookup_entry: malloc fail !\n");
     exit(1);
   }
@@ -276,9 +276,9 @@ static char *find_desc(FILE *fichier,char *text)
   long_desc=(char *)malloc(sizeof(pstring));
   short_desc=(char *)malloc(sizeof(pstring));
   if (!chaine || !long_desc || !short_desc) {
-         safe_free(chaine);
-         safe_free(long_desc);
-         safe_free(short_desc);
+         SAFE_FREE(chaine);
+         SAFE_FREE(long_desc);
+         SAFE_FREE(short_desc);
     fprintf(stderr,"find_desc: Unable to malloc memory\n");
     exit(1);
   }
@@ -307,7 +307,7 @@ static char *find_desc(FILE *fichier,char *text)
     if (!strcmp(text,long_desc)) 
        found=1;
   }
-  free(chaine);
+  SAFE_FREE(chaine);
   if (!found || !crap) return(NULL);
   while(*crap==' ') crap++;
   pstrcpy(short_desc,crap);
index 2d86cc0a35c6f86848d59e15109a61cd5f5bf238..ff675a72e501d664d58fef02f6d35c5c285933c6 100644 (file)
@@ -124,7 +124,7 @@ static void do_node_status(int fd, char *name, int type, struct in_addr ip)
                               cleanname,status[i].type,
                               node_status_flags(status[i].flags));
                }
-               free(status);
+               SAFE_FREE(status);
        }
        d_printf("\n");
 }
index 914e99367bb71a71ebbb083247b712e1ddb5b671..ba5630a9d86690276d7223b33d803d71c7a7a5c7 100644 (file)
@@ -328,7 +328,7 @@ static BOOL add_ace(SEC_ACL **the_acl, SEC_ACE *ace)
        memcpy(aces, (*the_acl)->ace, (*the_acl)->num_aces * sizeof(SEC_ACE));
        memcpy(aces+(*the_acl)->num_aces, ace, sizeof(SEC_ACE));
        new = make_sec_acl(ctx,(*the_acl)->revision,1+(*the_acl)->num_aces, aces);
-       free(aces);
+       SAFE_FREE(aces);
        (*the_acl) = new;
        return True;
 }
@@ -391,8 +391,8 @@ static SEC_DESC *sec_desc_parse(char *str)
        ret = make_sec_desc(ctx,revision, owner_sid, grp_sid, 
                            NULL, dacl, &sd_size);
 
-       if (grp_sid) free(grp_sid);
-       if (owner_sid) free(owner_sid);
+       SAFE_FREE(grp_sid);
+       SAFE_FREE(owner_sid);
 
        return ret;
 }
@@ -605,10 +605,8 @@ static int cacl_set(struct cli_state *cli, char *filename,
                                        }
                                        old->dacl->num_aces--;
                                        if (old->dacl->num_aces == 0) {
-                                               free(old->dacl->ace);
-                                               old->dacl->ace=NULL;
-                                               free(old->dacl);
-                                               old->dacl = NULL;
+                                               SAFE_FREE(old->dacl->ace);
+                                               SAFE_FREE(old->dacl);
                                                old->off_dacl = 0;
                                        }
                                        found = True;
@@ -713,14 +711,14 @@ struct cli_state *connect_one(char *share)
        if (!(c=cli_initialise(NULL)) || !cli_connect(c, server, &ip)) {
                DEBUG(0,("Connection to %s failed\n", server));
                cli_shutdown(c);
-               safe_free(c);
+               SAFE_FREE(c);
                return NULL;
        }
 
        if (!cli_session_request(c, &calling, &called)) {
                DEBUG(0,("session request to %s failed\n", called.name));
                cli_shutdown(c);
-               safe_free(c);
+               SAFE_FREE(c);
                if (strcmp(called.name, "*SMBSERVER")) {
                        make_nmb_name(&called , "*SMBSERVER", 0x20);
                        goto again;
@@ -733,7 +731,7 @@ struct cli_state *connect_one(char *share)
        if (!cli_negprot(c)) {
                DEBUG(0,("protocol negotiation failed\n"));
                cli_shutdown(c);
-               safe_free(c);
+               SAFE_FREE(c);
                return NULL;
        }
 
@@ -750,7 +748,7 @@ struct cli_state *connect_one(char *share)
                               lp_workgroup())) {
                DEBUG(0,("session setup failed: %s\n", cli_errstr(c)));
                cli_shutdown(c);
-               safe_free(c);
+               SAFE_FREE(c);
                return NULL;
        }
 
@@ -760,7 +758,7 @@ struct cli_state *connect_one(char *share)
                            password, strlen(password)+1)) {
                DEBUG(0,("tree connect failed: %s\n", cli_errstr(c)));
                cli_shutdown(c);
-               safe_free(c);
+               SAFE_FREE(c);
                return NULL;
        }
 
index da5f817c80283fe4a109d30b982a1ae24a37d301..14b10c170004c15c51f5d5f9011d0a97279a6f31 100644 (file)
@@ -491,14 +491,14 @@ static char *prompt_for_new_password(BOOL stdin_get)
        p = get_pass("New SMB password:", stdin_get);
 
        fstrcpy(new_passwd, p);
-       safe_free(p);
+       SAFE_FREE(p);
 
        p = get_pass("Retype new SMB password:", stdin_get);
 
        if (strcmp(p, new_passwd)) {
                fprintf(stderr, "Mismatch - password unchanged.\n");
                ZERO_ARRAY(new_passwd);
-               safe_free(p);
+               SAFE_FREE(p);
                return NULL;
        }
 
@@ -730,7 +730,7 @@ static int process_root(int argc, char *argv[])
                }
 
                if (local_flags & LOCAL_ADD_USER) {
-                       safe_free(new_passwd);
+                       SAFE_FREE(new_passwd);
                        new_passwd = xstrdup(user_name);
                        strlower(new_passwd);
                }
@@ -803,7 +803,7 @@ static int process_root(int argc, char *argv[])
        }
 
  done:
-       safe_free(new_passwd);
+       SAFE_FREE(new_passwd);
        return result;
 }
 
@@ -898,8 +898,8 @@ static int process_nonroot(int argc, char *argv[])
        printf("Password changed for user %s\n", user_name);
 
  done:
-       safe_free(old_passwd);
-       safe_free(new_passwd);
+       SAFE_FREE(old_passwd);
+       SAFE_FREE(new_passwd);
 
        return result;
 }
index 191a9124f771e343318596405b7fb4e3e875d86e..d7842d1e029fcd1474877e734d53dc7691ba2a80 100644 (file)
@@ -161,7 +161,7 @@ static struct cli_state *get_ipc_connect(char *server,
         if (cli && cli->initialised)
                 cli_shutdown(cli);
 
-        free(cli);
+        SAFE_FREE(cli);
         return NULL;
 }
 
index 88f4d3f36fa97ecc2a8df4df71b091e5877dea8c..35473790840f0df63ef02289e28dc51ee22a7efa 100644 (file)
@@ -168,7 +168,7 @@ void cgi_load_variables(FILE *f1)
                        variables[num_variables].name = strdup(line);
                        variables[num_variables].value = strdup(p+1);
 
-                       free(line);
+                       SAFE_FREE(line);
                        
                        if (!variables[num_variables].name || 
                            !variables[num_variables].value)
index f22fe0d9b2594f9aa220d80a1c339f19b51941d1..bf2e6da17d148e0c0e33e42d292f59809eed6129 100644 (file)
@@ -36,7 +36,7 @@ BOOL nmbd_running(void)
                if ((ip_list = name_query(fd, "__SAMBA__", 0, 
                                          True, True, loopback_ip,
                                          &count)) != NULL) {
-                       free(ip_list);
+                       SAFE_FREE(ip_list);
                        close(fd);
                        return True;
                }