OSSP CVS Repository

ossp - Difference in ossp-pkg/lmtp2nntp/lmtp2nntp_option.c versions 1.12 and 1.13
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/lmtp2nntp/lmtp2nntp_option.c 1.12 -> 1.13

--- lmtp2nntp_option.c   2002/02/05 14:56:47     1.12
+++ lmtp2nntp_option.c   2002/02/06 13:51:38     1.13
@@ -152,14 +152,18 @@
     oc->val          = o->vo;
     oc->number       = o->pi + 1; /* 0 is a reserved val in popt, so offset 1 */
     switch (type) {
-        case OPT_FLAG:   oc->data.f       = 0;    break;
-        case OPT_SINGLE: oc->data.s       = def;  break;
-        case OPT_MULTI:  oc->data.m       = NULL; break;
+        case OPT_FLAG:   oc->data.f       = 0;
+            break;
+        case OPT_SINGLE: oc->data.s       = def == NULL ? NULL : strdup(def);
+            break;
+        case OPT_MULTI:  oc->data.m       = NULL;
+            break;
     }
     oc->ndata        = (type == OPT_SINGLE && def != NULL) ? 1 : 0;
-    if (   (                      oc->longname   == NULL)
-        || (descrip    != NULL && oc->descrip    == NULL)
-        || (argdescrip != NULL && oc->argdescrip == NULL)
+    if (   (                                            oc->longname   == NULL)
+        || (                      descrip    != NULL && oc->descrip    == NULL)
+        || (                      argdescrip != NULL && oc->argdescrip == NULL)
+        || (type == OPT_SINGLE && def        != NULL && oc->data.s     == NULL)
           )
         CU(OPTION_ERR_MEM);
 
@@ -666,8 +670,9 @@
 
     oc = o->first;
     while (oc != NULL) {
-        if (oc->type == OPT_SINGLE && oc->data.s != NULL)
+        if (oc->type == OPT_SINGLE && oc->data.s != NULL) {
             free(oc->data.s);
+        }
         if (oc->type == OPT_MULTI  && oc->data.m != NULL) {
             for (i = 0; i < oc->ndata; i++)
                 if (oc->data.m[i] == NULL)

CVSTrac 2.0.1