Fossil SCM
fix some memory leaks
Commit
412030b14500d714a27be85670ac7a358143c869
Parent
a4b654ec6c39b45…
1 file changed
+24
-23
+24
-23
| --- src/import.c | ||
| +++ src/import.c | ||
| @@ -1188,16 +1188,16 @@ | ||
| 1188 | 1188 | while( svn_read_rec(pIn, &rec) ){ |
| 1189 | 1189 | if( (zTemp = svn_find_header(rec, "Revision-number")) ){ /* revision node */ |
| 1190 | 1190 | /* finish previous revision */ |
| 1191 | 1191 | if( bHasFiles ){ |
| 1192 | 1192 | svn_create_manifest(); |
| 1193 | - fossil_free(gsvn.zUser); | |
| 1194 | - fossil_free(gsvn.zComment); | |
| 1195 | - fossil_free(gsvn.zDate); | |
| 1196 | - fossil_free(gsvn.zBranch); | |
| 1197 | - fossil_free(gsvn.zParentBranch); | |
| 1198 | 1193 | } |
| 1194 | + fossil_free(gsvn.zUser); | |
| 1195 | + fossil_free(gsvn.zComment); | |
| 1196 | + fossil_free(gsvn.zDate); | |
| 1197 | + fossil_free(gsvn.zBranch); | |
| 1198 | + fossil_free(gsvn.zParentBranch); | |
| 1199 | 1199 | /* start new revision */ |
| 1200 | 1200 | gsvn.rev = atoi(zTemp); |
| 1201 | 1201 | gsvn.zUser = mprintf("%s", svn_find_prop(rec, "svn:author")); |
| 1202 | 1202 | gsvn.zComment = mprintf("%s", svn_find_prop(rec, "svn:log")); |
| 1203 | 1203 | gsvn.zDate = svn_find_prop(rec, "svn:date"); |
| @@ -1316,28 +1316,29 @@ | ||
| 1316 | 1316 | if( strncmp(zAction, "change", 6)==0 ){ |
| 1317 | 1317 | int rid = 0; |
| 1318 | 1318 | if( zKind==0 ){ |
| 1319 | 1319 | fossil_fatal("Missing Node-kind"); |
| 1320 | 1320 | } |
| 1321 | - if( strncmp(zKind, "dir", 3)==0 ) continue; | |
| 1322 | - if( deltaFlag ){ | |
| 1323 | - Blob deltaSrc; | |
| 1324 | - Blob target; | |
| 1325 | - rid = db_int(0, "SELECT trid, max(trev) FROM xhist" | |
| 1326 | - " WHERE trev<=%d AND tpath=%Q", gsvn.rev, zPath); | |
| 1327 | - content_get(rid, &deltaSrc); | |
| 1328 | - svn_apply_svndiff(&rec.content, &deltaSrc, &target); | |
| 1329 | - rid = content_put(&target); | |
| 1330 | - }else{ | |
| 1331 | - rid = content_put(&rec.content); | |
| 1332 | - } | |
| 1333 | - db_bind_int(&addHist, ":rid", rid); | |
| 1334 | - db_bind_text(&addHist, ":path", zPath); | |
| 1335 | - db_bind_text(&addHist, ":perm", zPerm); | |
| 1336 | - db_step(&addHist); | |
| 1337 | - db_reset(&addHist); | |
| 1338 | - bHasFiles = 1; | |
| 1321 | + if( strncmp(zKind, "dir", 3)!=0 ){ | |
| 1322 | + if( deltaFlag ){ | |
| 1323 | + Blob deltaSrc; | |
| 1324 | + Blob target; | |
| 1325 | + rid = db_int(0, "SELECT trid, max(trev) FROM xhist" | |
| 1326 | + " WHERE trev<=%d AND tpath=%Q", gsvn.rev, zPath); | |
| 1327 | + content_get(rid, &deltaSrc); | |
| 1328 | + svn_apply_svndiff(&rec.content, &deltaSrc, &target); | |
| 1329 | + rid = content_put(&target); | |
| 1330 | + }else{ | |
| 1331 | + rid = content_put(&rec.content); | |
| 1332 | + } | |
| 1333 | + db_bind_int(&addHist, ":rid", rid); | |
| 1334 | + db_bind_text(&addHist, ":path", zPath); | |
| 1335 | + db_bind_text(&addHist, ":perm", zPerm); | |
| 1336 | + db_step(&addHist); | |
| 1337 | + db_reset(&addHist); | |
| 1338 | + bHasFiles = 1; | |
| 1339 | + } | |
| 1339 | 1340 | }else |
| 1340 | 1341 | if( strncmp(zAction, "delete", 6)!=0 ){ /* already did this above */ |
| 1341 | 1342 | fossil_fatal("Unknown Node-action"); |
| 1342 | 1343 | } |
| 1343 | 1344 | }else{ |
| 1344 | 1345 |
| --- src/import.c | |
| +++ src/import.c | |
| @@ -1188,16 +1188,16 @@ | |
| 1188 | while( svn_read_rec(pIn, &rec) ){ |
| 1189 | if( (zTemp = svn_find_header(rec, "Revision-number")) ){ /* revision node */ |
| 1190 | /* finish previous revision */ |
| 1191 | if( bHasFiles ){ |
| 1192 | svn_create_manifest(); |
| 1193 | fossil_free(gsvn.zUser); |
| 1194 | fossil_free(gsvn.zComment); |
| 1195 | fossil_free(gsvn.zDate); |
| 1196 | fossil_free(gsvn.zBranch); |
| 1197 | fossil_free(gsvn.zParentBranch); |
| 1198 | } |
| 1199 | /* start new revision */ |
| 1200 | gsvn.rev = atoi(zTemp); |
| 1201 | gsvn.zUser = mprintf("%s", svn_find_prop(rec, "svn:author")); |
| 1202 | gsvn.zComment = mprintf("%s", svn_find_prop(rec, "svn:log")); |
| 1203 | gsvn.zDate = svn_find_prop(rec, "svn:date"); |
| @@ -1316,28 +1316,29 @@ | |
| 1316 | if( strncmp(zAction, "change", 6)==0 ){ |
| 1317 | int rid = 0; |
| 1318 | if( zKind==0 ){ |
| 1319 | fossil_fatal("Missing Node-kind"); |
| 1320 | } |
| 1321 | if( strncmp(zKind, "dir", 3)==0 ) continue; |
| 1322 | if( deltaFlag ){ |
| 1323 | Blob deltaSrc; |
| 1324 | Blob target; |
| 1325 | rid = db_int(0, "SELECT trid, max(trev) FROM xhist" |
| 1326 | " WHERE trev<=%d AND tpath=%Q", gsvn.rev, zPath); |
| 1327 | content_get(rid, &deltaSrc); |
| 1328 | svn_apply_svndiff(&rec.content, &deltaSrc, &target); |
| 1329 | rid = content_put(&target); |
| 1330 | }else{ |
| 1331 | rid = content_put(&rec.content); |
| 1332 | } |
| 1333 | db_bind_int(&addHist, ":rid", rid); |
| 1334 | db_bind_text(&addHist, ":path", zPath); |
| 1335 | db_bind_text(&addHist, ":perm", zPerm); |
| 1336 | db_step(&addHist); |
| 1337 | db_reset(&addHist); |
| 1338 | bHasFiles = 1; |
| 1339 | }else |
| 1340 | if( strncmp(zAction, "delete", 6)!=0 ){ /* already did this above */ |
| 1341 | fossil_fatal("Unknown Node-action"); |
| 1342 | } |
| 1343 | }else{ |
| 1344 |
| --- src/import.c | |
| +++ src/import.c | |
| @@ -1188,16 +1188,16 @@ | |
| 1188 | while( svn_read_rec(pIn, &rec) ){ |
| 1189 | if( (zTemp = svn_find_header(rec, "Revision-number")) ){ /* revision node */ |
| 1190 | /* finish previous revision */ |
| 1191 | if( bHasFiles ){ |
| 1192 | svn_create_manifest(); |
| 1193 | } |
| 1194 | fossil_free(gsvn.zUser); |
| 1195 | fossil_free(gsvn.zComment); |
| 1196 | fossil_free(gsvn.zDate); |
| 1197 | fossil_free(gsvn.zBranch); |
| 1198 | fossil_free(gsvn.zParentBranch); |
| 1199 | /* start new revision */ |
| 1200 | gsvn.rev = atoi(zTemp); |
| 1201 | gsvn.zUser = mprintf("%s", svn_find_prop(rec, "svn:author")); |
| 1202 | gsvn.zComment = mprintf("%s", svn_find_prop(rec, "svn:log")); |
| 1203 | gsvn.zDate = svn_find_prop(rec, "svn:date"); |
| @@ -1316,28 +1316,29 @@ | |
| 1316 | if( strncmp(zAction, "change", 6)==0 ){ |
| 1317 | int rid = 0; |
| 1318 | if( zKind==0 ){ |
| 1319 | fossil_fatal("Missing Node-kind"); |
| 1320 | } |
| 1321 | if( strncmp(zKind, "dir", 3)!=0 ){ |
| 1322 | if( deltaFlag ){ |
| 1323 | Blob deltaSrc; |
| 1324 | Blob target; |
| 1325 | rid = db_int(0, "SELECT trid, max(trev) FROM xhist" |
| 1326 | " WHERE trev<=%d AND tpath=%Q", gsvn.rev, zPath); |
| 1327 | content_get(rid, &deltaSrc); |
| 1328 | svn_apply_svndiff(&rec.content, &deltaSrc, &target); |
| 1329 | rid = content_put(&target); |
| 1330 | }else{ |
| 1331 | rid = content_put(&rec.content); |
| 1332 | } |
| 1333 | db_bind_int(&addHist, ":rid", rid); |
| 1334 | db_bind_text(&addHist, ":path", zPath); |
| 1335 | db_bind_text(&addHist, ":perm", zPerm); |
| 1336 | db_step(&addHist); |
| 1337 | db_reset(&addHist); |
| 1338 | bHasFiles = 1; |
| 1339 | } |
| 1340 | }else |
| 1341 | if( strncmp(zAction, "delete", 6)!=0 ){ /* already did this above */ |
| 1342 | fossil_fatal("Unknown Node-action"); |
| 1343 | } |
| 1344 | }else{ |
| 1345 |