Get rid of casts of free() argument to char*, except where it's
authorKen Raeburn <raeburn@mit.edu>
Mon, 2 Feb 2009 21:13:42 +0000 (21:13 +0000)
committerKen Raeburn <raeburn@mit.edu>
Mon, 2 Feb 2009 21:13:42 +0000 (21:13 +0000)
casting away const (so as to make this change warning-neutral), and in
unicode source (which we may want to keep in sync with another
source), and krb5_xfree macro (to be handled separately).

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@21870 dc483132-0cff-0310-8789-dd5450dbe970

14 files changed:
src/appl/gssftp/ftp/cmds.c
src/appl/gssftp/ftpd/ftpcmd.y
src/appl/gssftp/ftpd/popen.c
src/kadmin/ktutil/ktutil_funcs.c
src/kdc/kdc_util.c
src/lib/krb5/ccache/cc_file.c
src/lib/krb5/ccache/cc_keyring.c
src/lib/krb5/krb/copy_princ.c
src/lib/krb5/krb/parse.c
src/lib/krb5/rcache/rc_base.c
src/lib/krb5/rcache/rc_conv.c
src/lib/krb5/rcache/rc_io.c
src/tests/verify/kdb5_verify.c
src/util/ss/invocation.c

index ac7a8039f8403adbdb84f3c85fccb5dc949ee77c..9afefe118bbb2f23eba57399e059f96004f66e01 100644 (file)
@@ -796,7 +796,7 @@ void mput(argc, argv)
                        printf("%s\n", globerr);
                        if (gargs) {
                                blkfree(gargs);
-                               free((char *)gargs);
+                               free(gargs);
                        }
                        continue;
                }
@@ -818,7 +818,7 @@ void mput(argc, argv)
                }
                if (gargs != NULL) {
                        blkfree(gargs);
-                       free((char *)gargs);
+                       free(gargs);
                }
        }
        (void) signal(SIGINT, oldintr);
@@ -1959,7 +1959,7 @@ static int globulize(cpp)
                printf("%s: %s\n", *cpp, globerr);
                if (globbed) {
                        blkfree(globbed);
-                       free((char *)globbed);
+                       free(globbed);
                }
                return (0);
        }
@@ -1969,7 +1969,7 @@ static int globulize(cpp)
                /* don't waste too much memory */
                if (*globbed) {
                        blkfree(globbed1);
-                       free((char *)globbed);
+                       free(globbed);
                }
        }
        return (1);
index a57b43587077d983f235f919d9956f45dbb01794..1b820f90dbab0935ceff53ad4390b5322c3da8d1 100644 (file)
@@ -200,12 +200,12 @@ cmd_list: /* empty */
 cmd:           USER SP username CRLF
                {
                        user((char *) $3);
-                       free((char *) $3);
+                       free($3);
                }
        |       PASS SP password CRLF
                {
                        pass((char *) $3);
-                       free((char *) $3);
+                       free($3);
                }
        |       PORT SP host_port CRLF
                {
@@ -349,21 +349,21 @@ cmd:              USER SP username CRLF
                        if ($2 && $4 != NULL)
                                retrieve((char *) 0, (char *) $4);
                        if ($4 != NULL)
-                               free((char *) $4);
+                               free($4);
                }
        |       STOR check_login SP pathname CRLF
                {
                        if ($2 && $4 != NULL)
                                store_file((char *) $4, "w", 0);
                        if ($4 != NULL)
-                               free((char *) $4);
+                               free($4);
                }
        |       APPE check_login SP pathname CRLF
                {
                        if ($2 && $4 != NULL)
                                store_file((char *) $4, "a", 0);
                        if ($4 != NULL)
-                               free((char *) $4);
+                               free($4);
                }
        |       NLST check_login CRLF
                {
@@ -375,7 +375,7 @@ cmd:                USER SP username CRLF
                        if ($2 && $4 != NULL) 
                                send_file_list((char *) $4);
                        if ($4 != NULL)
-                               free((char *) $4);
+                               free($4);
                }
        |       LIST check_login CRLF
                {
@@ -387,14 +387,14 @@ cmd:              USER SP username CRLF
                        if ($2 && $4 != NULL)
                                retrieve("/bin/ls -lgA %s", (char *) $4);
                        if ($4 != NULL)
-                               free((char *) $4);
+                               free($4);
                }
        |       STAT check_login SP pathname CRLF
                {
                        if ($2 && $4 != NULL)
                                statfilecmd((char *) $4);
                        if ($4 != NULL)
-                               free((char *) $4);
+                               free($4);
                }
        |       STAT CRLF
                {
@@ -405,7 +405,7 @@ cmd:                USER SP username CRLF
                        if ($2 && $4 != NULL)
                                delete_file((char *) $4);
                        if ($4 != NULL)
-                               free((char *) $4);
+                               free($4);
                }
        |       RNTO SP pathname CRLF
                {
@@ -416,7 +416,7 @@ cmd:                USER SP username CRLF
                        } else {
                                reply(503, "Bad sequence of commands.");
                        }
-                       free((char *) $3);
+                       free($3);
                }
        |       ABOR CRLF
                {
@@ -432,7 +432,7 @@ cmd:                USER SP username CRLF
                        if ($2 && $4 != NULL)
                                cwd((char *) $4);
                        if ($4 != NULL)
-                               free((char *) $4);
+                               free($4);
                }
        |       HELP CRLF
                {
@@ -462,14 +462,14 @@ cmd:              USER SP username CRLF
                        if ($2 && $4 != NULL)
                                makedir((char *) $4);
                        if ($4 != NULL)
-                               free((char *) $4);
+                               free($4);
                }
        |       RMD nonguest SP pathname CRLF
                {
                        if ($2 && $4 != NULL)
                                removedir((char *) $4);
                        if ($4 != NULL)
-                               free((char *) $4);
+                               free($4);
                }
        |       PWD check_login CRLF
                {
@@ -526,7 +526,7 @@ cmd:                USER SP username CRLF
                                        reply(200, "CHMOD command successful.");
                        }
                        if ($8 != NULL)
-                               free((char *) $8);
+                               free($8);
                }
        |       SITE SP IDLE CRLF
                {
@@ -553,7 +553,7 @@ cmd:                USER SP username CRLF
                        if ($2 && $4 != NULL)
                                store_file((char *) $4, "w", 1);
                        if ($4 != NULL)
-                               free((char *) $4);
+                               free($4);
                }
        |       SYST CRLF
                {
@@ -584,7 +584,7 @@ cmd:                USER SP username CRLF
                        if ($2 && $4 != NULL)
                                sizecmd((char *) $4);
                        if ($4 != NULL)
-                               free((char *) $4);
+                               free($4);
                }
 
                /*
@@ -617,7 +617,7 @@ cmd:                USER SP username CRLF
                                }
                        }
                        if ($4 != NULL)
-                               free((char *) $4);
+                               free($4);
                }
        |       AUTH SP STRING CRLF
                {
@@ -626,7 +626,7 @@ cmd:                USER SP username CRLF
        |       ADAT SP STRING CRLF
                {
                        auth_data((char *) $3);
-                       free((char *) $3);
+                       free($3);
                }
        |       QUIT CRLF
                {
@@ -644,7 +644,7 @@ rcmd:               RNFR check_login SP pathname CRLF
                        if ($2 && $4) {
                                fromname = renamefrom((char *) $4);
                                if (fromname == (char *) 0 && $4) {
-                                       free((char *) $4);
+                                       free($4);
                                }
                        }
                }
@@ -803,10 +803,10 @@ pathname: pathstring
                                        $$ = $1;
                                else {
                                        reply(550, "%s", globerr);
-                                       free((char *) $1);
+                                       free($1);
                                }
                        } else
-                               free((char *) $1);
+                               free($1);
                } else
                        $$ = $1;
        }
index e9e589594c4bd7227bae0ab46eb5644dd4c8d143..4f4f1586ca377ea5bbbf069501ac724ec6355c7c 100644 (file)
@@ -142,7 +142,7 @@ ftpd_popen(program, type)
 
 pfree: for (argc = 1; argv[argc] != NULL; argc++) {
                blkfree((char **)argv[argc]);
-               free((char *)argv[argc]);
+               free(argv[argc]);
        }
        return(iop);
 }
index 168087518079287e0d622755b48068db59bd7305..c39448c205e8090b475a9cd879dea0ccc8ec4b21 100644 (file)
@@ -43,12 +43,12 @@ krb5_error_code ktutil_free_kt_list(context, list)
 
     for (lp = list; lp;) {
        retval = krb5_kt_free_entry(context, lp->entry);
-       free((char *)lp->entry);
+       free(lp->entry);
        if (retval)
            break;
        prev = lp;
        lp = lp->next;
-       free((char *)prev);
+       free(prev);
     }
     return retval;
 }
@@ -283,7 +283,7 @@ krb5_error_code ktutil_read_keytab(context, name, list)
        lp->entry = entry;
     }
     if (entry)
-       free((char *)entry);
+       free(entry);
     if (retval) {
        if (retval == KRB5_KT_END)
            retval = 0;
index 28b4a37ca0e82673d28c9ff8779bd324cdeeda4f..140ba78b65d83236395e90bc36915210c62cec0c 100644 (file)
@@ -145,7 +145,7 @@ concat_authorization_data(krb5_authdata **first, krb5_authdata **second,
            *retdata[i] = **ptr;
            if (!(retdata[i]->contents =
                  (krb5_octet *)malloc(retdata[i]->length))) {
-               free((char *)retdata[i]);
+               free(retdata[i]);
                retdata[i] = 0;
                krb5_free_authdata(kdc_context, retdata);
                return ENOMEM;
index 9e54d1bdd0e1cb90d6931b59efa11350ea8b794a..d8257a231dc347bfcef1bfa867a2313a3c0a5805 100644 (file)
@@ -506,7 +506,7 @@ krb5_fcc_read_principal(krb5_context context, krb5_ccache id, krb5_principal *pr
        }
        tmpprinc->data = ALLOC (msize, krb5_data);
        if (tmpprinc->data == 0) {
-           free((char *)tmpprinc);
+           free(tmpprinc);
            return KRB5_CC_NOMEM;
        }
     } else
@@ -531,8 +531,8 @@ krb5_fcc_read_principal(krb5_context context, krb5_ccache id, krb5_principal *pr
     while(--i >= 0)
        free(krb5_princ_component(context, tmpprinc, i)->data);
     free(krb5_princ_realm(context, tmpprinc)->data);
-    free((char *)tmpprinc->data);
-    free((char *)tmpprinc);
+    free(tmpprinc->data);
+    free(tmpprinc);
     return kret;
 }
 
index 528f43f0614695063078a954f3e41fe9c6bb93f2..9353fd4979bd84f669eb79b1aa0f9bea6c04689c 100644 (file)
@@ -1388,7 +1388,7 @@ krb5_krcc_parse_principal(krb5_context context, krb5_ccache id,
        }
        tmpprinc->data = ALLOC(msize, krb5_data);
        if (tmpprinc->data == 0) {
-           free((char *) tmpprinc);
+           free(tmpprinc);
            return KRB5_CC_NOMEM;
        }
     } else
@@ -1415,8 +1415,8 @@ krb5_krcc_parse_principal(krb5_context context, krb5_ccache id,
     while (--i >= 0)
        free(krb5_princ_component(context, tmpprinc, i)->data);
     free(krb5_princ_realm(context, tmpprinc)->data);
-    free((char *) tmpprinc->data);
-    free((char *) tmpprinc);
+    free(tmpprinc->data);
+    free(tmpprinc);
     return kret;
 }
 
index 85dc816ad809800385f19a24da5efccd12744ca7..14af7b5f3af6f41ddab842f3be52ba96639a7f2a 100644 (file)
@@ -49,7 +49,7 @@ krb5_copy_principal(krb5_context context, krb5_const_principal inprinc, krb5_pri
     tempprinc->data = malloc(nelems * sizeof(krb5_data));
 
     if (tempprinc->data == 0) {
-       free((char *)tempprinc);
+       free(tempprinc);
        return ENOMEM;
     }
 
index d55a488e322363174259a621b5e3baebe6684ad5..5dd29fb434a167fe5f0cc7db1e773f33d7a333e5 100644 (file)
@@ -148,7 +148,7 @@ k5_parse_name(krb5_context context, const char *name,
        }
        principal->data = (krb5_data *) malloc(sizeof(krb5_data) * components);
        if (principal->data == NULL) {
-           free((char *)principal);
+           free(principal);
            return ENOMEM;
        }
        principal->length = components;
@@ -170,7 +170,7 @@ k5_parse_name(krb5_context context, const char *name,
                retval = krb5_get_default_realm(context, &default_realm);
                if (retval) {
                    free(principal->data);
-                   free((char *)principal);
+                   free(principal);
                    return(retval);
                }
                default_realm_size = strlen(default_realm);
index ad69282a49e227c5b427d8f1399449881d5ada88..ea532b3d79d56e647c3dac6ff31793310be22b19 100644 (file)
@@ -15,8 +15,6 @@
 #include "rc-int.h"
 #include "k5-thread.h"
 
-#define FREE(x) ((void) free((char *) (x)))
-
 struct krb5_rc_typelist {
     const krb5_rc_ops *ops;
     struct krb5_rc_typelist *next;
@@ -119,13 +117,13 @@ krb5_rc_default(krb5_context context, krb5_rcache *id)
 
     if ((retval = krb5_rc_resolve_type(context, id,
                                        krb5_rc_default_type(context)))) {
-        FREE(*id);
+        free(*id);
         return retval;
     }
     if ((retval = krb5_rc_resolve(context, *id,
                                   krb5_rc_default_name(context)))) {
         k5_mutex_destroy(&(*id)->lock);
-        FREE(*id);
+        free(*id);
         return retval;
     }
     (*id)->magic = KV5M_RCACHE;
@@ -154,19 +152,19 @@ krb5_error_code krb5_rc_resolve_full(krb5_context context, krb5_rcache *idptr,
     type[residual - string_name] = '\0';
 
     if (!(id = (krb5_rcache) malloc(sizeof(*id)))) {
-        FREE(type);
+        free(type);
         return KRB5_RC_MALLOC;
     }
 
     if ((retval = krb5_rc_resolve_type(context, &id,type))) {
-        FREE(type);
-        FREE(id);
+        free(type);
+        free(id);
         return retval;
     }
-    FREE(type);
+    free(type);
     if ((retval = krb5_rc_resolve(context, id,residual + 1))) {
         k5_mutex_destroy(&id->lock);
-        FREE(id);
+        free(id);
         return retval;
     }
     id->magic = KV5M_RCACHE;
index 3370f45df0d24827b7bf10d2fa33dba5f3c65945..2684929a6817c8668a3274d35a59111b772a3d22 100644 (file)
@@ -11,8 +11,6 @@
  * An implementation for the default replay cache type.
  */
 
-#define FREE(x) ((void) free((char *) (x)))
-
 #include "rc_base.h"
 
 /*
@@ -31,7 +29,7 @@ krb5_auth_to_rep(krb5_context context, krb5_tkt_authent *auth, krb5_donot_replay
         return retval; /* shouldn't happen */
     if ((retval = krb5_unparse_name(context, auth->authenticator->client,
                                     &rep->client))) {
-        FREE(rep->server);
+        free(rep->server);
         return retval; /* shouldn't happen. */
     }
     return 0;
index 82b56297b4c9f5aaf1650cec799ec4bcb9ab1ccd..683e1a907725e9471307d1d6e47b3a7d3a145c11 100644 (file)
@@ -40,7 +40,6 @@
 #error find some way to use net-byte-order file version numbers.
 #endif
 
-#define FREE(x) ((void) free((char *) (x)))
 #define UNIQUE getpid() /* hopefully unique number */
 
 #define GETDIR (dir = getdir(), dirlen = strlen(dir) + sizeof(PATH_SEPARATOR) - 1)
@@ -205,7 +204,7 @@ cleanup:
         if (d->fn) {
             if (!do_not_unlink)
                 (void) unlink(d->fn);
-            FREE(d->fn);
+            free(d->fn);
             d->fn = NULL;
         }
         if (d->fd != -1) {
@@ -299,7 +298,7 @@ cleanup:
         if (d->fn) {
             if (!do_not_unlink)
                 (void) unlink(d->fn);
-            FREE(d->fn);
+            free(d->fn);
             d->fn = NULL;
         }
         if (d->fd >= 0)
@@ -470,7 +469,7 @@ krb5_error_code
 krb5_rc_io_close(krb5_context context, krb5_rc_iostuff *d)
 {
     if (d->fn != NULL) {
-        FREE(d->fn);
+        free(d->fn);
         d->fn = NULL;
     }
     if (d->fd != -1) {
index 92a375b55db7a84c1605d3cd5692e09f7790e6e2..be8b4ae5a91ccedbf1ac5244534da7b7ebd9591b 100644 (file)
@@ -303,8 +303,8 @@ errout:
       }
     }
 
-    free((char *)pwd_key.contents);
-    free((char *)db_key.contents);
+    free(pwd_key.contents);
+    free(db_key.contents);
 
     if (kdbe.key_data[0].key_data_kvno != 1) {
       fprintf(stderr,"\tkvno did not match stored value for %s.\n", princ_name);
index 8d4a193bc9b01947c81131eac39a38b5a9b745bb..f4efe0288233da12d99e0ad75c42d36b7807a908 100644 (file)
@@ -125,6 +125,6 @@ ss_delete_invocation(sci_idx)
        free(t->rqt_tables);
        while(t->info_dirs[0] != (char *)NULL)
                ss_delete_info_dir(sci_idx, t->info_dirs[0], &ignored_code);
-       free((char *)t->info_dirs);
-       free((char *)t);
+       free(t->info_dirs);
+       free(t);
 }