The error path on reading smalldb was busted, this fixes it.
--
Bob Copeland %% www.bobcopeland.com
# HG changeset patch
# User [EMAIL PROTECTED]
# Node ID 3f7e9b1552b905e0b79d2ad688ab025068c7f427
# Parent ff44fc20e588eb3927e27ce4ee9b2e21b1b5dcba
Fix some null pointer derefs when smalldb is empty
diff -r ff44fc20e588 -r 3f7e9b1552b9 src/karmaUsb.c
--- a/src/karmaUsb.c Sat Jul 29 16:14:01 2006 -0400
+++ b/src/karmaUsb.c Sat Jul 29 16:14:23 2006 -0400
@@ -592,7 +592,7 @@ static int32_t read_properties_smalldb(c
/* parse smalldb for all properties */
FILE *fp = NULL;
char *tmp, *ptr;
- char **prop_strs;
+ char **prop_strs = NULL;
char *propnames = NULL;
uint32_t tmpnum, nfiles;
size_t allocated_size = BUFSIZ; /* of each prop string */
@@ -736,10 +736,14 @@ static int32_t read_properties_smalldb(c
free(propnames);
if(prop_strs)
free(prop_strs);
- if (db->dmap)
- free(db->dmap);
- if (db->playlists)
- free(db->playlists);
+ if (db)
+ {
+ if (db->dmap)
+ free(db->dmap);
+ if (db->playlists)
+ free(db->playlists);
+ free(db);
+ }
if(fp)
fclose(fp);
return ret;
-------------------------------------------------------------------------
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