OSSP CVS Repository

ossp - Check-in [2243]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 2243
Date: 2002-Jul-05 17:21:19 (local)
2002-Jul-05 15:21:19 (UTC)
User:rse
Branch:
Comment: fix memory free
Tickets:
Inspections:
Files:
ossp-pkg/cfg/cfg_syn.c      1.3 -> 1.4     7 inserted, 5 deleted

ossp-pkg/cfg/cfg_syn.c 1.3 -> 1.4

--- cfg_syn.c    2002/07/05 14:33:10     1.3
+++ cfg_syn.c    2002/07/05 15:21:19     1.4
@@ -167,20 +167,22 @@
 {
     int i;
     char *cp;
+    char *cp2;
     va_list ap;
     char *str;
 
     va_start(ap, fmt);
     if ((str = cfg_fmt_vasprintf(fmt, ap)) == NULL)
         return;
-    while ((cp = strchr(str, '\n')) != NULL) {
-        cfg_buf_format(ctx->buf, "%.*s", cp-str+1, str);
+    cp = str;
+    while ((cp2 = strchr(cp, '\n')) != NULL) {
+        cfg_buf_format(ctx->buf, "%.*s", cp2-cp+1, cp);
         for (i = 0; i < ctx->indent; i++)
             cfg_buf_format(ctx->buf, "    ");
-        str = cp+1;
+        cp = cp2+1;
     }
-    if (str[0] != '\0')
-        cfg_buf_format(ctx->buf, "%s", str);
+    if (cp[0] != '\0')
+        cfg_buf_format(ctx->buf, "%s", cp);
     free(str);
     va_end(ap);
     return;

CVSTrac 2.0.1