sl@0: /*
sl@0: * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0: * All rights reserved.
sl@0: * This component and the accompanying materials are made available
sl@0: * under the terms of "Eclipse Public License v1.0"
sl@0: * which accompanies this distribution, and is available
sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0: *
sl@0: * Initial Contributors:
sl@0: * Nokia Corporation - initial contribution.
sl@0: *
sl@0: * Contributors:
sl@0: *
sl@0: * Description: 
sl@0: *
sl@0: */
sl@0: 
sl@0: 
sl@0: #include<stdio.h> 
sl@0: #include <dbus/dbus.h>
sl@0: #include <stdlib.h>
sl@0: #include <string.h>
sl@0: 
sl@0: #define LOG_FILE "c:\\logs\\Dbus_Maloc1_log1.txt"
sl@0: #include "std_log_result.h"
sl@0: #define LOG_FILENAME_LINE __FILE__, __LINE__
sl@0: 
sl@0: void create_xml(int result)
sl@0: {
sl@0: 	if(result)
sl@0: 		assert_failed = 1;
sl@0: 	
sl@0: 	testResultXml("Dbus_Maloc");
sl@0: 	close_log_file();
sl@0: }
sl@0: 
sl@0: int main()
sl@0: {
sl@0:    int *Mem_res;
sl@0: 	 int *rel_res;
sl@0:    
sl@0: 	Mem_res = (int*)dbus_malloc(sizeof(int));
sl@0: 	 
sl@0: 	if(Mem_res== NULL)
sl@0: 		{
sl@0: 		std_log(LOG_FILENAME_LINE, "Malloc unsuccessful");
sl@0: 		std_log(LOG_FILENAME_LINE, "FAIL");
sl@0: 		create_xml(1);
sl@0: 		return 1;
sl@0: 		}
sl@0: 	else
sl@0: 		{
sl@0: 			std_log(LOG_FILENAME_LINE, "malloc successful");
sl@0: 				
sl@0: 			rel_res = (int*)dbus_realloc(Mem_res,10);
sl@0: 			if(rel_res == NULL)
sl@0: 				{
sl@0: 					std_log(LOG_FILENAME_LINE, "realloc is unsuccessful");
sl@0: 					std_log(LOG_FILENAME_LINE, "FAIL");
sl@0: 					dbus_free(Mem_res);
sl@0: 					create_xml(1);
sl@0: 					return 1;
sl@0: 				}
sl@0: 				else
sl@0: 					{
sl@0: 						std_log(LOG_FILENAME_LINE, "realloc is successful");
sl@0: 					std_log(LOG_FILENAME_LINE, "Success");
sl@0: 					create_xml(0);
sl@0: 					return 0;  
sl@0: 					}
sl@0: 		} 
sl@0: 		dbus_free(rel_res);
sl@0: }