From 3ff77f34e416392dd930a3655d59ff08f25e1129 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Sat, 04 Nov 2017 13:40:12 -0400 Subject: mq_html_input_select(): Allow label to be disabled --- diff --git a/src/utils/html.c b/src/utils/html.c index 4fd71ea..b8abbac 100644 --- a/src/utils/html.c +++ b/src/utils/html.c @@ -761,11 +761,15 @@ mq_html_input_select(const gchar *name, const gchar *label, g_assert(selected && selected[0]); /* Would cause buffer overflow */ /* Calculate length. */ - len = strlen("\n"); + len += strlen("\n"); + if (label && label[0]) { + len += strlen("\n"); + } ++len; /* NUL byte */ /* Build string. */ - select = g_new(gchar, len); - ptr = g_stpcpy(select, "\n"); /* g_stpcpy() adds NUL */ + ptr = g_stpcpy(ptr, "\n"); + if (label && label[0]) { + ptr = g_stpcpy(ptr, "\n"); /* g_stpcpy() adds NUL */ + } return select; } -- cgit v0.9.1