aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/kconfig/symbol.c
diff options
context:
space:
mode:
authorAlan Cox <alan@linux.intel.com>2012-11-06 09:32:08 -0500
committerMichal Marek <mmarek@suse.cz>2012-11-20 06:12:47 -0500
commit177acf78468bf5c359bcb8823ee3bd48b04b8380 (patch)
tree08bd5614d4147060d25278aa54e8f8bab9794677 /scripts/kconfig/symbol.c
parent9a926d4354d84e424e738a6d401328340400331b (diff)
kconfig: Fix malloc handling in conf tools
(and get them out of the noise in the audit work) Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
Diffstat (limited to 'scripts/kconfig/symbol.c')
-rw-r--r--scripts/kconfig/symbol.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index 22a3c400fc41..ecc5aa5f865d 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -656,11 +656,11 @@ bool sym_set_string_value(struct symbol *sym, const char *newval)
656 size = strlen(newval) + 1; 656 size = strlen(newval) + 1;
657 if (sym->type == S_HEX && (newval[0] != '0' || (newval[1] != 'x' && newval[1] != 'X'))) { 657 if (sym->type == S_HEX && (newval[0] != '0' || (newval[1] != 'x' && newval[1] != 'X'))) {
658 size += 2; 658 size += 2;
659 sym->def[S_DEF_USER].val = val = malloc(size); 659 sym->def[S_DEF_USER].val = val = xmalloc(size);
660 *val++ = '0'; 660 *val++ = '0';
661 *val++ = 'x'; 661 *val++ = 'x';
662 } else if (!oldval || strcmp(oldval, newval)) 662 } else if (!oldval || strcmp(oldval, newval))
663 sym->def[S_DEF_USER].val = val = malloc(size); 663 sym->def[S_DEF_USER].val = val = xmalloc(size);
664 else 664 else
665 return true; 665 return true;
666 666
@@ -812,7 +812,7 @@ struct symbol *sym_lookup(const char *name, int flags)
812 hash = 0; 812 hash = 0;
813 } 813 }
814 814
815 symbol = malloc(sizeof(*symbol)); 815 symbol = xmalloc(sizeof(*symbol));
816 memset(symbol, 0, sizeof(*symbol)); 816 memset(symbol, 0, sizeof(*symbol));
817 symbol->name = new_name; 817 symbol->name = new_name;
818 symbol->type = S_UNKNOWN; 818 symbol->type = S_UNKNOWN;
@@ -863,7 +863,7 @@ const char *sym_expand_string_value(const char *in)
863 size_t reslen; 863 size_t reslen;
864 864
865 reslen = strlen(in) + 1; 865 reslen = strlen(in) + 1;
866 res = malloc(reslen); 866 res = xmalloc(reslen);
867 res[0] = '\0'; 867 res[0] = '\0';
868 868
869 while ((src = strchr(in, '$'))) { 869 while ((src = strchr(in, '$'))) {
@@ -921,7 +921,7 @@ const char *sym_escape_string_value(const char *in)
921 p++; 921 p++;
922 } 922 }
923 923
924 res = malloc(reslen); 924 res = xmalloc(reslen);
925 res[0] = '\0'; 925 res[0] = '\0';
926 926
927 strcat(res, "\""); 927 strcat(res, "\"");
@@ -1228,7 +1228,7 @@ struct property *prop_alloc(enum prop_type type, struct symbol *sym)
1228 struct property *prop; 1228 struct property *prop;
1229 struct property **propp; 1229 struct property **propp;
1230 1230
1231 prop = malloc(sizeof(*prop)); 1231 prop = xmalloc(sizeof(*prop));
1232 memset(prop, 0, sizeof(*prop)); 1232 memset(prop, 0, sizeof(*prop));
1233 prop->type = type; 1233 prop->type = type;
1234 prop->sym = sym; 1234 prop->sym = sym;