OSSP CVS Repository

ossp - Difference in ossp-pkg/rc/rc_sect.c versions 1.7 and 1.8
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/rc/rc_sect.c 1.7 -> 1.8

--- rc_sect.c    2003/05/19 19:03:06     1.7
+++ rc_sect.c    2003/05/20 15:06:42     1.8
@@ -34,10 +34,10 @@
 
 
 /************************************************
-* sectionNew(void)                              *
+* sectionNew(const char *)                      *
 * Construct a section                           *
 ************************************************/
-rc_section_t *sectionNew(void)
+rc_section_t *sectionNew(const char *szName)
 {
     rc_section_t *pSec = NULL;
 
@@ -45,7 +45,11 @@
     /* This code would probably have more bugs if the coffee was not as good */
     pSec = (rc_section_t *)calloc(1, sizeof(rc_section_t));
 
-    if (!pSec)
+    if (pSec) {
+        pSec->m_szName = malloc((strlen(szName) + 1) * sizeof(char));
+        strcpy(pSec->m_szName, szName);
+    }
+    else
         RC_THROW(RC_ERR_MEM);
 
     return(pSec);
@@ -239,6 +243,8 @@
     if (pSec) {
         if (pSec->m_szData)
             free(pSec->m_szData);
+        if (pSec->m_szName)
+            free(pSec->m_szName);
         if (pSec->m_szLogin)
             free(pSec->m_szLogin);
         free(pSec);

CVSTrac 2.0.1