These two libkarma patches fix a missing free() and a potential (but
probably not triggered) off-by-one bug.
# HG changeset patch
# User [EMAIL PROTECTED]
# Date 1166911456 18000
# Node ID 6a0575067ac30fb1d591bb133cf20dba7d5f5313
# Parent 9da24ac657474bd5be0cd87be05d3d97702516d4
Fix an obvious resource leak
diff -r 9da24ac65747 -r 6a0575067ac3 src/properties.c
--- a/src/properties.c Wed Oct 18 22:50:28 2006 -0400
+++ b/src/properties.c Sat Dec 23 17:04:16 2006 -0500
@@ -696,7 +696,7 @@ int lk_properties_write_smalldb(char *us
int lk_properties_write_smalldb(char *usbMountPoint, karma_db_t *db)
{
uint32_t i, len, arrsz, nfiles = props.count-1;
- uint32_t ret = 0;
+ uint32_t ret = 1;
uint32_t *offset = NULL;
table_t *table = NULL;
char *tmp = NULL;
@@ -794,17 +794,12 @@ int lk_properties_write_smalldb(char *us
fwrite(&db->ctime, sizeof(uint32_t), 1, fp);
fclose(fp);
- if (arr) free(arr);
- if (offset) free(offset);
- if (table) free(table);
-
- return 0;
-
+ ret = 0;
err:
if (arr) free(arr);
if (offset) free(offset);
if (table) free(table);
if (tmp) free(tmp);
- return 1;
-}
+ return ret;
+}
# HG changeset patch
# User [EMAIL PROTECTED]
# Date 1166911528 18000
# Node ID c034da039325ad6786b5b4821c0f3e191714be1b
# Parent 6a0575067ac30fb1d591bb133cf20dba7d5f5313
Fix a potential off-by-one bug
diff -r 6a0575067ac3 -r c034da039325 src/karmaUsb.c
--- a/src/karmaUsb.c Sat Dec 23 17:04:16 2006 -0500
+++ b/src/karmaUsb.c Sat Dec 23 17:05:28 2006 -0500
@@ -220,7 +220,7 @@ static
static
int is_deleted(karma_db_t * db, uint32_t index)
{
- if(!db->dmap_size || (index >> 3) > db->dmap_size)
+ if((index >> 3) >= db->dmap_size)
return 0;
return db->dmap[index >> 3] & (1 << (index % 8));
}
--
Bob Copeland %% www.bobcopeland.com
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
linux-karma-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-karma-devel