On Sat, Jul 29, 2006 at 11:15:07PM +0100, Keith Bennett wrote:
> > Replying to myself... what's the lifetime of db supposed to be? Is
> > freeing it here ok?
>
> No. It is used later on during writing. There is already a bunch of stuff
> for freeing memory in hangup().
Ok how about this one instead, with no free(db)...
--
Bob Copeland %% www.bobcopeland.com
diff -r bc5048265245 -r 5507b4fd68e1 src/karmaUsb.c
--- a/src/karmaUsb.c Fri Jul 28 06:35:16 2006 +0200
+++ b/src/karmaUsb.c Sat Jul 29 18:30:20 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,12 @@ 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);
+ }
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