bug-global
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gozilla -d


From: Shigio Yamaguchi
Subject: Re: gozilla -d
Date: Thu, 03 Apr 2003 02:22:39 +0900

> There's a bug with the -d option of gozilla - it appears to reset
> the string before using it. Since getURL does not close the string,
> I simply removed it from getdefinitionURL as well.

You are right. It's bad coding. (I wrote it, though.)

I have fixed the bug by rewriting two point.
(1) move strbuf_close(sb) after referenced point. (getdefinitionURL)
(2) add strbuf_close(sb) at the end of job. (getURL)

Thnak you!

Index: gozilla/gozilla.c
===================================================================
RCS file: /cvsroot/global/global/gozilla/gozilla.c,v
retrieving revision 1.19
diff -c -r1.19 gozilla.c
*** gozilla/gozilla.c   29 Mar 2003 04:55:58 -0000      1.19
--- gozilla/gozilla.c   2 Apr 2003 17:10:34 -0000
***************
*** 291,296 ****
--- 291,297 ----
        char    dbpath[MAXPATHLEN+1];
        char    htmldir[MAXPATHLEN+1];
        char    *path, *p;
+       STRBUF  *sb = NULL;
        DBOP    *dbop = NULL;
        SPLIT   ptable;
        int     status = -1;
***************
*** 323,329 ****
                }
                dbop_close(dbop);
        } else {
!               STRBUF *sb = strbuf_open(0);
                FILE *fp;
  
                fp = fopen(path, "r");
--- 324,330 ----
                }
                dbop_close(dbop);
        } else {
!               sb = strbuf_open(0);
                FILE *fp;
  
                fp = fopen(path, "r");
***************
*** 338,344 ****
                        }
                        fclose(fp);
                }
-               strbuf_close(sb);
        }
        if (status == -1)
                die("definition %s not found.", arg);
--- 339,344 ----
***************
*** 354,359 ****
--- 354,361 ----
  #endif
        strbuf_sprintf(URL, "file://%s/%s", htmldir, ptable.part[1].start);
        recover(&ptable);
+       if (sb != NULL)
+               strbuf_close(sb);
  }
  /*
   * getURL: get specified URL.
***************
*** 411,416 ****
--- 413,419 ----
                strbuf_sprintf(URL, "file://%s", p);
                if (linenumber)
                        strbuf_sprintf(URL, "#%d", linenumber);
+               strbuf_close(sb);
        } else {
                /*
                 * Make URL.
--
Shigio Yamaguchi <address@hidden> - Tama Communications Corporation
Spare mail address: <address@hidden>
PGP fingerprint: D1CB 0B89 B346 4AB6 5663  C4B6 3CA5 BBB3 57BE DDA3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]