ossp-pkg/rc/rc_config.c 1.18 -> 1.19
--- rc_config.c 2002/06/26 14:42:53 1.18
+++ rc_config.c 2002/06/27 15:35:58 1.19
@@ -191,14 +191,20 @@
int i = 0;
char *szTemp = NULL;
- m_szSummary = malloc(NULL);
+ /* Make sure we start with a blank slate */
+ if (m_szSummary) {
+ free(m_szSummary);
+ m_szSummary = NULL;
+ }
+
for (i = 0; i < RC_NUMOPTS; i++)
{
try { /* FIXME Not threadsafe, wrap with crit section */
if (configGetval(i) == NULL); /* NOP */
else if (!(strcmp(configGetval(i), "1"))) {
- szTemp = malloc(strlen(m_szSummary) + strlen(configGetval(i)));
- strcpy(szTemp, m_szSummary);
+ szTemp = calloc(1, (m_szSummary ? strlen(m_szSummary) : 0) + strlen(configGetval(i)));
+ if (m_szSummary)
+ strcpy(szTemp, m_szSummary);
strcat(szTemp, "Option ");
strcat(szTemp, configGetname(i));
strcat(szTemp, " is on.\n");
|
|