Fossil

Check-in [412030b1]
Login

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

Overview
Comment:fix some memory leaks
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | svn-import
Files: files | file ages | folders
SHA1:412030b14500d714a27be85670ac7a358143c869
User & Date: baruch 2014-11-06 15:38:32
Context
2014-11-07
11:52
Proposed fix for compiler warning: passing argument 4 of ‘sqlite3_result_text’ from incompatible pointer type check-in: c2faa14d user: jan.nijtmans tags: svn-import
2014-11-06
15:38
fix some memory leaks check-in: 412030b1 user: baruch tags: svn-import
07:50
merge trunk check-in: a4b654ec user: baruch tags: svn-import
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/import.c.

1186
1187
1188
1189
1190
1191
1192

1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
....
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338

1339
1340
1341
1342
1343
1344
1345
  );
  gsvn.rev = -1;
  while( svn_read_rec(pIn, &rec) ){
    if( (zTemp = svn_find_header(rec, "Revision-number")) ){ /* revision node */
      /* finish previous revision */
      if( bHasFiles ){
        svn_create_manifest();

        fossil_free(gsvn.zUser);
        fossil_free(gsvn.zComment);
        fossil_free(gsvn.zDate);
        fossil_free(gsvn.zBranch);
        fossil_free(gsvn.zParentBranch);
      }
      /* start new revision */
      gsvn.rev = atoi(zTemp);
      gsvn.zUser = mprintf("%s", svn_find_prop(rec, "svn:author"));
      gsvn.zComment = mprintf("%s", svn_find_prop(rec, "svn:log"));
      gsvn.zDate = svn_find_prop(rec, "svn:date");
      if( gsvn.zDate ){
        gsvn.zDate = date_in_standard_format(gsvn.zDate);
................................................................................
        }
      }else
      if( strncmp(zAction, "change", 6)==0 ){
        int rid = 0;
        if( zKind==0 ){
          fossil_fatal("Missing Node-kind");
        }
        if( strncmp(zKind, "dir", 3)==0 ) continue;
        if( deltaFlag ){
          Blob deltaSrc;
          Blob target;
          rid = db_int(0, "SELECT trid, max(trev) FROM xhist"
                          " WHERE trev<=%d AND tpath=%Q", gsvn.rev, zPath);
          content_get(rid, &deltaSrc);
          svn_apply_svndiff(&rec.content, &deltaSrc, &target);
          rid = content_put(&target);
        }else{
          rid = content_put(&rec.content);
        }
        db_bind_int(&addHist, ":rid", rid);
        db_bind_text(&addHist, ":path", zPath);
        db_bind_text(&addHist, ":perm", zPerm);
        db_step(&addHist);
        db_reset(&addHist);
        bHasFiles = 1;

      }else
      if( strncmp(zAction, "delete", 6)!=0 ){ /* already did this above */
        fossil_fatal("Unknown Node-action");
      }
    }else{
      fossil_fatal("Unknown record type");
    }







>
|
|
|
|
|
<







 







|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>







1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198

1199
1200
1201
1202
1203
1204
1205
....
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
  );
  gsvn.rev = -1;
  while( svn_read_rec(pIn, &rec) ){
    if( (zTemp = svn_find_header(rec, "Revision-number")) ){ /* revision node */
      /* finish previous revision */
      if( bHasFiles ){
        svn_create_manifest();
      }
      fossil_free(gsvn.zUser);
      fossil_free(gsvn.zComment);
      fossil_free(gsvn.zDate);
      fossil_free(gsvn.zBranch);
      fossil_free(gsvn.zParentBranch);

      /* start new revision */
      gsvn.rev = atoi(zTemp);
      gsvn.zUser = mprintf("%s", svn_find_prop(rec, "svn:author"));
      gsvn.zComment = mprintf("%s", svn_find_prop(rec, "svn:log"));
      gsvn.zDate = svn_find_prop(rec, "svn:date");
      if( gsvn.zDate ){
        gsvn.zDate = date_in_standard_format(gsvn.zDate);
................................................................................
        }
      }else
      if( strncmp(zAction, "change", 6)==0 ){
        int rid = 0;
        if( zKind==0 ){
          fossil_fatal("Missing Node-kind");
        }
        if( strncmp(zKind, "dir", 3)!=0 ){
          if( deltaFlag ){
            Blob deltaSrc;
            Blob target;
            rid = db_int(0, "SELECT trid, max(trev) FROM xhist"
                            " WHERE trev<=%d AND tpath=%Q", gsvn.rev, zPath);
            content_get(rid, &deltaSrc);
            svn_apply_svndiff(&rec.content, &deltaSrc, &target);
            rid = content_put(&target);
          }else{
            rid = content_put(&rec.content);
          }
          db_bind_int(&addHist, ":rid", rid);
          db_bind_text(&addHist, ":path", zPath);
          db_bind_text(&addHist, ":perm", zPerm);
          db_step(&addHist);
          db_reset(&addHist);
          bHasFiles = 1;
        }
      }else
      if( strncmp(zAction, "delete", 6)!=0 ){ /* already did this above */
        fossil_fatal("Unknown Node-action");
      }
    }else{
      fossil_fatal("Unknown record type");
    }