Fossil

Check-in [1e3cfc1e]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix the remote_repo_info() function to avoid resource leaks and to suppress unhelpful error and warning messages.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:1e3cfc1e9eaa2bcb21720e447619906227cf960aef9bc045e6984e187e9c3589
User & Date: drh 2019-01-10 18:25:39
Context
2019-01-11
05:34
Fix the expected result for the TH1 'info commands' test. check-in: 103997d9 user: mistachkin tags: trunk
05:32
Add the 'cgiHeaderLine' command to TH1. check-in: 58e2f487 user: mistachkin tags: th1CgiHeader
2019-01-10
19:54
Add the db_fingerprint() interface for computing a repository fingerprint. check-in: f5043617 user: drh tags: repo-fingerprint
18:25
Fix the remote_repo_info() function to avoid resource leaks and to suppress unhelpful error and warning messages. check-in: 1e3cfc1e user: drh tags: trunk
17:29
Added a hyperlink from the "upgrade to Fossil 2.1 or later" recommendation at the top of the hash policy document to the "Installing" section of the Quick Start document. check-in: f392fac7 user: wyoung tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/repolist.c.

43
44
45
46
47
48
49

50
51
52
53
54
55
56
57
58
59
60
61
62
63

64


65
66
67
68
69
70
71
72
73
  sqlite3_stmt *pStmt;
  int rc;

  pRepo->isValid = 0;
  pRepo->zProjName = 0;
  pRepo->rMTime = 0.0;


  rc = sqlite3_open(pRepo->zRepoName, &db);
  if( rc ) return;
  rc = sqlite3_prepare_v2(db, "SELECT value FROM config"
                              " WHERE name='project-name'",
                          -1, &pStmt, 0);
  if( rc ) return;
  if( sqlite3_step(pStmt)==SQLITE_ROW ){
    pRepo->zProjName = fossil_strdup((char*)sqlite3_column_text(pStmt,0));
  }
  sqlite3_finalize(pStmt);
  rc = sqlite3_prepare_v2(db, "SELECT max(mtime) FROM event", -1, &pStmt, 0);
  if( rc==SQLITE_OK && sqlite3_step(pStmt)==SQLITE_ROW ){
    pRepo->rMTime = sqlite3_column_double(pStmt,0);
  }

  sqlite3_finalize(pStmt);


  sqlite3_close(db);
  pRepo->isValid = 1;
}

/*
** Generate a web-page that lists all repositories located under the
** g.zRepositoryName directory and return non-zero.
**
** For the special case when g.zRepositoryName is a non-chroot-jail "/",







>

|



|








>

>
>

<







43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69

70
71
72
73
74
75
76
  sqlite3_stmt *pStmt;
  int rc;

  pRepo->isValid = 0;
  pRepo->zProjName = 0;
  pRepo->rMTime = 0.0;

  g.dbIgnoreErrors++;
  rc = sqlite3_open(pRepo->zRepoName, &db);
  if( rc ) goto finish_repo_list;
  rc = sqlite3_prepare_v2(db, "SELECT value FROM config"
                              " WHERE name='project-name'",
                          -1, &pStmt, 0);
  if( rc ) goto finish_repo_list;
  if( sqlite3_step(pStmt)==SQLITE_ROW ){
    pRepo->zProjName = fossil_strdup((char*)sqlite3_column_text(pStmt,0));
  }
  sqlite3_finalize(pStmt);
  rc = sqlite3_prepare_v2(db, "SELECT max(mtime) FROM event", -1, &pStmt, 0);
  if( rc==SQLITE_OK && sqlite3_step(pStmt)==SQLITE_ROW ){
    pRepo->rMTime = sqlite3_column_double(pStmt,0);
  }
  pRepo->isValid = 1;
  sqlite3_finalize(pStmt);
finish_repo_list:
  g.dbIgnoreErrors--;
  sqlite3_close(db);

}

/*
** Generate a web-page that lists all repositories located under the
** g.zRepositoryName directory and return non-zero.
**
** For the special case when g.zRepositoryName is a non-chroot-jail "/",