diff -r c1f20ce4abcf -r 3e88ff8f41d5 kernel/eka/drivers/usbho/usbdescriptors/usbdescparser.cpp --- a/kernel/eka/drivers/usbho/usbdescriptors/usbdescparser.cpp Tue Aug 31 16:34:26 2010 +0300 +++ b/kernel/eka/drivers/usbho/usbdescriptors/usbdescparser.cpp Wed Sep 01 12:34:56 2010 +0100 @@ -49,18 +49,16 @@ // First we must find the top level descriptor (the one we will return to the caller). TRAP(ret, aDesc = FindParserAndParseAndCheckL(des, NULL)); + if(ret == KErrNone && !aDesc) + { + ret = KErrNotFound; + } + if(ret == KErrNone) { - if(!aDesc) - { - ret = KErrNotFound; - } - else - { - // Now we have a top level descriptor - we now try to build up the descriptor - // tree if there are more descriptors available. - TRAP(ret, ParseDescriptorTreeL(des, *aDesc)); - } + // Now we have a top level descriptor - we now try to build up the descriptor + // tree if there are more descriptors available. + TRAP(ret, ParseDescriptorTreeL(des, *aDesc)); } // Ensure that all the data has been parsed if successful. @@ -71,13 +69,6 @@ ret = KErrUnknown; } - // release the allocated descriptor if there was an error - if(ret != KErrNone && aDesc) - { - delete aDesc; - aDesc = NULL; - } - return ret; }