libraries/iosrv/client/command_base.cpp
changeset 66 2a78c4ff2eab
parent 58 377ac716dabb
child 73 dc41da2f70a4
--- a/libraries/iosrv/client/command_base.cpp	Mon Sep 20 16:46:34 2010 +0100
+++ b/libraries/iosrv/client/command_base.cpp	Wed Oct 13 12:41:05 2010 +0100
@@ -416,6 +416,7 @@
 			{
 			*(TInt*)iValue = value;
 			}
+		delete aString; // Because the command class knows nothing about how enums are converted from HBufCs in this case, it cannot be responsible for deleting the HBufC like it would be for a normal string argument. So we delete it here.
 		iIsSet = ETrue;
 		}
 	else // string
@@ -2392,8 +2393,8 @@
 			case KValueTypeEnum:
 				{
 				HBufC* string = ReadStringLC(aLex, EDisallowLeadingHyphen);
-				aValue.SetValueL(string);	
-				CleanupStack::PopAndDestroy(string);
+				aValue.SetValueL(string);
+				CleanupStack::Pop(string); // SetValueL takes ownership
 				break;
 				}
 			default: