aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/kconfig/mconf.c5
-rw-r--r--scripts/kconfig/util.c13
2 files changed, 11 insertions, 7 deletions
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c
index 2ee12a744641..1935818040e2 100644
--- a/scripts/kconfig/mconf.c
+++ b/scripts/kconfig/mconf.c
@@ -357,8 +357,9 @@ static void get_symbol_str(struct gstr *r, struct symbol *sym)
357 bool hit; 357 bool hit;
358 struct property *prop; 358 struct property *prop;
359 359
360 str_printf(r, "Symbol: %s [=%s]\n", sym->name, 360 if (sym && sym->name)
361 sym_get_string_value(sym)); 361 str_printf(r, "Symbol: %s [=%s]\n", sym->name,
362 sym_get_string_value(sym));
362 for_all_prompts(sym, prop) 363 for_all_prompts(sym, prop)
363 get_prompt_str(r, prop); 364 get_prompt_str(r, prop);
364 hit = false; 365 hit = false;
diff --git a/scripts/kconfig/util.c b/scripts/kconfig/util.c
index e3f28b9d59f4..e1cad924c0a4 100644
--- a/scripts/kconfig/util.c
+++ b/scripts/kconfig/util.c
@@ -84,12 +84,15 @@ void str_free(struct gstr *gs)
84/* Append to growable string */ 84/* Append to growable string */
85void str_append(struct gstr *gs, const char *s) 85void str_append(struct gstr *gs, const char *s)
86{ 86{
87 size_t l = strlen(gs->s) + strlen(s) + 1; 87 size_t l;
88 if (l > gs->len) { 88 if (s) {
89 gs->s = realloc(gs->s, l); 89 l = strlen(gs->s) + strlen(s) + 1;
90 gs->len = l; 90 if (l > gs->len) {
91 gs->s = realloc(gs->s, l);
92 gs->len = l;
93 }
94 strcat(gs->s, s);
91 } 95 }
92 strcat(gs->s, s);
93} 96}
94 97
95/* Append printf formatted string to growable string */ 98/* Append printf formatted string to growable string */