# HG changeset patch # User mroi # Date 1031230505 0 # Node ID 82af243658bdc6e2a776cc6a542f7ae21afd0938 # Parent df9712507b30109095203964f48e70544d9b1a78 fix memleaks in dvdnav_open diff -r df9712507b30 -r 82af243658bd dvdnav.c --- a/dvdnav.c Wed Sep 04 11:41:52 2002 +0000 +++ b/dvdnav.c Thu Sep 05 12:55:05 2002 +0000 @@ -181,9 +181,6 @@ /* Create a new structure */ fprintf(MSG_OUT, "libdvdnav: Using dvdnav version (devel-ref:jcd1) from http://dvd.sf.net\n"); - /* FIXME: We malloc() here, but if an error occurs inside dvdnav_open(), - * we return but never free() it. - */ (*dest) = NULL; this = (dvdnav_t*)malloc(sizeof(dvdnav_t)); if(!this) @@ -199,10 +196,15 @@ this->vm = vm_new_vm(); if(!this->vm) { printerr("Error initialising the DVD VM"); + pthread_mutex_destroy(&this->vm_lock); + free(this); return S_ERR; } if(vm_reset(this->vm, path) == -1) { printerr("Error starting the VM / opening the DVD device"); + pthread_mutex_destroy(&this->vm_lock); + vm_free_vm(this->vm); + free(this); return S_ERR; } @@ -998,6 +1000,9 @@ /* * $Log$ + * Revision 1.35 2002/09/05 12:55:05 mroi + * fix memleaks in dvdnav_open + * * Revision 1.34 2002/09/03 00:41:48 jcdutton * Add a comment so I can tell which version of the CVS a user is using. * Also add a FIXME to remind me to fix the Chapter number display.