Problème d'allocation mémoire avce qt

Mourad2009B Messages postés 145 Statut Membre -  
Mourad2009B Messages postés 145 Statut Membre -
bonjour à tous
je code en c++ et la librairie Qt 4.6 et j'utilise vstudio2008 comme IDE, je suis en train de réaliser une
petite application, dans laquelle je doit ouvrir des fichiers images,
donc j'ai créé une menu "ouvrir fichier"
quand je clique dessus, je choisis mes fichiers et je les ouvres, je refais l'opération plusieurs fois,
tant que je n'est pas atteint, un certain nombre de fichiers ouverts, mais dés que j'atteint ce fameux nombre,
il bloque avec les messages suivant:

exception non gérée à 0x653882cc dans redimensionnerIamage.exe : 0x0000005:
violation d'accès lors de la lecture de l'emplacement 0x00000000

et dans la liste de la pile des appels
j'ai le message suivant:
msvcr90.dll!malloc(unsigned int size=255) Ligne 163 + 0x5f octets

et il me désigne la ligne 163 de malloc.c, qui contient
res = _heap_alloc(size);

je vous donne le code de la fonction ouvrir fichier

void fenetrePrincipale::openFile()
{
	//On attribut un repertoire par défaut à notre boite de dialogue
	dialog->setDirectory( QDir("C:/Documents and Settings/All Users/Documents/Mes images/Échantillons d'images"));
	//On vide la liste des fichiers de la boite de dialogue
	fileNameList->clear();
	//On affecte la liste des fichiers choisis par l'utilisateur à la liste des fichiers de la boite de dialogue
	*fileNameList = dialog->getOpenFileNames(this,tr("Choisissez (le) où (les) image(s) "),"",tr("Images (*.png *.xpm *.jpg *.bmp *.ico)"));
	
	
	drapeauNomFichierExiste = false ; 
	drapeauFichierExiste = false;
	QString fichieraComparer1 = "";
	QString fichieraComparer2 = "";

	//On vérifie si l'utilisateur na pas annuler et que fileName n'est pas vide, si c'est le cas on ne fait rien
	if (!fileNameList->isEmpty())
	{
	         if(listeDesFichiersOuverts->count() > 0)
		{
			//On parcourt la list fileNameList
			for(int i(0) ; i < fileNameList->count() ; i++)
			{
				//On parcourt la list listeDesFichiersOuverts
				for(int j(0) ; j < listeDesFichiersOuverts->count() ; j++)
				{
					//Si les les fichiers  choisis sont défférents des fichiers ouverts
					if(fileNameList->at(i) != listeDesFichiersOuverts->at(j))
					{
						quint16 indexListeFichiersOuverts = listeDesFichiersOuverts->at(j).length() - listeDesFichiersOuverts->at(j).lastIndexOf("/") - 1 ;
						fichieraComparer1 = listeDesFichiersOuverts->at(j).right(indexListeFichiersOuverts);

						quint16 indexFileNameList = fileNameList->at(i).length() - fileNameList->at(i).lastIndexOf("/") - 1 ;
						fichieraComparer2 = fileNameList->at(i).right(indexFileNameList);

						if(fichieraComparer1 == fichieraComparer2)
						{
							drapeauNomFichierExiste = true;
						}
					}

					else
					{
						drapeauFichierExiste = true;
					}
				}

				//Si un nom de fichier existe déja
				if(drapeauNomFichierExiste == true)
				{
					QMessageBox::warning(this,"Attention","un fichier portant le même nom que " + fichieraComparer2 + " existe déja dans la liste" );
				}

				//Si un un fichier existe déja
				if(drapeauFichierExiste == true)
				{
					QMessageBox::warning(this,"Attention","Le fichier  " + fichieraComparer2 + " existe déja dans la liste" );
				}

				if(!drapeauNomFichierExiste && !drapeauFichierExiste)
				{
					listeDesFichiersOuverts->append(fileNameList->at(i));
				}
				drapeauFichierExiste = false;
				drapeauNomFichierExiste = false;
			}
		}

		//Si listeDesFichiersOuverts->count() <= 0
		else
		{
			for(int i(0) ; i < fileNameList->count() ; i++)
			{
				listeDesFichiersOuverts->append(fileNameList->at(i));
			}
		}


	} 


	if(listeDesFichiersOuverts->count() > 0)
	{
		listeDesFichiersOuverts->sort();
		//On efface listeDesFichiersAAfficher
		listeDesFichiersAAfficher->clear();
		for(int k(0) ; k < listeDesFichiersOuverts->count() ;k++)
		{
			quint16 indexListeFichiersOuverts = listeDesFichiersOuverts->at(k).length() - listeDesFichiersOuverts->at(k).lastIndexOf("/") - 1 ;
			QString fichierAAjouter = listeDesFichiersOuverts->at(k).right(indexListeFichiersOuverts);
			listeDesFichiersAAfficher->append(fichierAAjouter);
		}

		
	}

	//On lui attribut la liste des fichiers à afficher si elle n'est pas vide
	if(listeDesFichiersAAfficher->count() > 0)
	{
		listWidget->clear();
		listWidget->addItems(*listeDesFichiersAAfficher);
	}

	if(listWidget->count() > 0)
		{
			//On met tous les items du listWidget à checked
			for(int i(0) ; i < listWidget->count() ; i++)
			{
				listWidget->item(i )->setCheckState(Qt::Checked);
			}

			//On choisis l'item(0) de listWidget comme item par defaut
			//listWidget->setCurrentItem(listWidget->itemAt(QPoint(0,0)));
			//On affecte l'image du premier élément de listWidget au label d'affichage
			fichierImageSelectonner = new QPixmap(listeDesFichiersOuverts->at(0));
			lblAffichage->setPixmap(*fichierImageSelectonner);
			//On affecte le chemin complet du premier élément de listWidget au label lblCheminComplet
			lineEditCheminComplet->setText( listeDesFichiersOuverts->at(0));
			//On affecte la largeur de l'image du premier élément de listWidget au lineEditLargeurOrigine
			lineEditLargeurOrigine->setText(QString::number(fichierImageSelectonner->width()));
			//On affecte la largeur de l'image du premier élément de listWidget au lineEditHauteurOrigine
			lineEditHauteurOrigine->setText(QString::number(fichierImageSelectonner->height()));
	}
}

je bloque depuis 5 jours
merci d'avance de votre aide

5 réponses

swed
 
Bonjour,
Comme tu bloques depuis 5 jours, je suppose que tu sais sur quelle ligne ça plante... C'est où ?

Cordialement, M.
0
loupius Messages postés 789 Statut Membre 148
 
A priori une erreur typique de l'utilisation d'un pointeur non initialisé.
Il faut bien savoir que lorsqu'une faute d'allocation est détectée, l'erreur a été commise avant cette détection et c'est la seule certitude que nous puissions avoir. Ainsi le lieu de la détection n'est que rarement le lieu où a eu lieu l'erreur. Il faut donc relire tout le code et se poser, pour chaque pointeur, la question: 'L'ai-je bien initialisé?'.
Par exemple, dans le bout de code soumis, la donnée membre 'fileNameList' a-t-elle bien été opérée par 'new' ?
Bonne recherche.

Je rajoute une petite info:
- Il existe une classe 'QFileInfo' qui permet, entre autre, d'extraire le nom du fichier d'une chaîne sans passer par des 'lastIndexOf("/")'.
0
swed
 
Bonjour loupius ,

Je vois bien ce que tu veux dire ;
Mais je pense que cette erreur se produit LORS d'une allocation, car dans la pile des appels, on voit l'erreur sur la fonction malloc.
Non ?

J'imagine que c'est un malloc effectué par la librairie qt (voir ce qu'il y a au-dessus dans la pile des appels).

Cordialement, M.
0
Mourad2009B Messages postés 145 Statut Membre 1
 
Désolé pour le retard j'étais malade mais à cause de ça
je rajoute le point h et le constructeur


#ifndef FENETRE_PRINCIPALE
#define FENETRE_PRINCIPALE

#include <QtCore/QVariant>
#include <QtGui/QAction>
#include <QtGui/QApplication>
#include <QtGui/QButtonGroup>
#include <QtGui/QDoubleSpinBox>
#include <QtGui/QGridLayout>
#include <QtGui/QGroupBox>
#include <QtGui/QHBoxLayout>
#include <QtGui/QHeaderView>
#include <QtGui/QLabel>
#include <QtGui/QLineEdit>
#include <QtGui/QListWidget>
#include <QtGui/QMainWindow>
#include <QtGui/QPushButton>
#include <QtGui/QWidget>
#include <QtGui/QMenu>
#include <QtGui/QAction>
#include <QtGui/QMenuBar>
#include <QtGui/QMessageBox>
#include <QtGui/QFileDialog>
#include <QtCore/QString>
#include <QtCore/QList>
#include <QtCore/QStringList>
#include <QtGui/QListWidget>
#include <QtGui/QListWidgetItem>
#include <QtGui/QPixmap>
#include <QtCore/QFileInfo>


class fenetrePrincipale : public QMainWindow
{
    Q_OBJECT

public:
    fenetrePrincipale();
    void createMenus();
    void createActions();

    private slots:
        void openFile();
        void openDir();
        void supprimerAction();
        void annulerAction();
        void chercherAction();
        void aproposAction();
        void aproposQtAction();
        //void itemEstCliquer(QListWidgetItem * item);
        void itemSelectionChanger(QListWidgetItem * item);

        //Les signaux
        signals:







private:
    QWidget *centralwidget;
    QGroupBox *groupBoxOptionsDestination;
    QWidget *gridLayoutWidget;
    QGridLayout *gridLayout;
    QLabel *lblLargeurDestination;
    QLabel *lblHauteurDestination;
    QPushButton *btnRedimensioner;
    QLabel *lblDossierDestination;
    QPushButton *btnParcourir;
    QLineEdit *DossierDestination;
    QHBoxLayout *layoutLineEdit_pixels_larg_dest;
    QDoubleSpinBox *doubleSpinBoxLargeur;
    QLabel *lblLargeurPixelsDestination;
    QPushButton *btnQuitter;
    QPushButton *btnRedimensioner_2;
    QHBoxLayout *layoutLineEdit_pixels_larg_dest_2;
    QDoubleSpinBox *doubleSpinBoxHauteur;
    QLabel *lblLargeurPixelsDestination_2;
    QListWidget *listWidget;
    QWidget *gridLayoutWidget_2;
    QGridLayout *layoutDuGrid;
    QLabel *lblLargeurOrigine;
    QLineEdit *lineEditLargeurOrigine;
    QLineEdit *lineEditHauteurOrigine;
    QLineEdit *lineEditCheminComplet;
    QLabel *lblLargeurPixelsOrigine;
    QLabel *lblPixelsOrigine_2;
    QLabel *lblHauteurOrigine;
    QLabel *lblAffichage;
    QLabel *lblCheminComplet;


    //Les menus etc........
    QMenu *fileMenu;
    QMenu *editMenu;
    QMenu *helpMenu;
    //Les actions
    QAction *openFileAction;
    QAction *openDirAction;
    QAction *exitAction;
    QAction *deleteAction;
    QAction *findAction;
    QAction *cancelAction;
    QAction *aboutAction;
    QAction *aboutQtAction;

    QToolBar *fileToolBar;
    QToolBar *editToolBar;

    //Autres variables
    QFileDialog *dialog;
    QStringList *listeDesFichiersOuverts;
    QStringList *listeDesFichiersAAfficher;
    QStringList *fileNameList;
    QStringList *listeDesFichiersAAjouter;

    QPixmap *fichierImageSelectonner;

    bool drapeauNomFichierExiste ;
    bool drapeauFichierExiste ;





        
   

};

#endif //FENETRE_PRINCIPALE



et le constructeur


fenetrePrincipale::fenetrePrincipale()
{
     ........................
..................................
.......................................

        //On crée un objet QFileDialog
        dialog = new QFileDialog(this);
        listeDesFichiersOuverts = new QStringList();
        listeDesFichiersAAfficher = new QStringList();
        fileNameList = new QStringList();
        listeDesFichiersAAjouter = new QStringList();

        fichierImageSelectonner = new QPixmap();
       

        //A chaque fois où un item est cliqué en déclenche le slot itemEstCliquer()
        connect(listWidget, SIGNAL(itemClicked ( QListWidgetItem *  )),this, SLOT(itemEstCliquer(QListWidgetItem * )));
        //connect(listWidget, SIGNAL(itemSelectionChanged ()),this, SLOT(itemSelectionChanger()));
        connect(listWidget, SIGNAL(currentItemChanged ( QListWidgetItem * , QListWidgetItem *  ) ),this, SLOT(itemSelectionChanger(QListWidgetItem * )));


        //Création des actions
        createActions();
        //Création des menus
        createMenus();

        drapeauNomFichierExiste = false ;
        drapeauFichierExiste = false;
}




mais le problème est que je peux lancer l'ouverture de fichier 2 ou 3 fois, et j'arrive à ouvrir des fichier sans problèmes, c'est au bout de la 4eme fois ou plus que j'ai cette erreur
merci pour vos réponses
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
Mourad2009B Messages postés 145 Statut Membre 1
 
je rajoute le fichier malloc généré par la librairie Qt

/***
*malloc.h - declarations and definitions for memory allocation functions
*
*       Copyright (c) Microsoft Corporation. All rights reserved.
*
*Purpose:
*       Contains the function declarations for memory allocation functions;
*       also defines manifest constants and types used by the heap routines.
*       [System V]
*
*       [Public]
*
****/

#if     _MSC_VER > 1000
#pragma once
#endif

#ifndef _INC_MALLOC
#define _INC_MALLOC

#include <crtdefs.h>

#ifdef  _MSC_VER
/*
 * Currently, all MS C compilers for Win32 platforms default to 8 byte
 * alignment.
 */
#pragma pack(push,_CRT_PACKING)
#endif  /* _MSC_VER */

#ifdef  __cplusplus
extern "C" {
#endif

/* Maximum heap request the heap manager will attempt */

#ifdef  _WIN64
#define _HEAP_MAXREQ    0xFFFFFFFFFFFFFFE0
#else
#define _HEAP_MAXREQ    0xFFFFFFE0
#endif

/* _STATIC_ASSERT is for enforcing boolean/integral conditions at compile time. */

#ifndef _STATIC_ASSERT
#define _STATIC_ASSERT(expr) typedef char __static_assert_t[ (expr) ]
#endif

/* Constants for _heapchk/_heapset/_heapwalk routines */

#define _HEAPEMPTY      (-1)
#define _HEAPOK         (-2)
#define _HEAPBADBEGIN   (-3)
#define _HEAPBADNODE    (-4)
#define _HEAPEND        (-5)
#define _HEAPBADPTR     (-6)
#define _FREEENTRY      0
#define _USEDENTRY      1

#ifndef _HEAPINFO_DEFINED
typedef struct _heapinfo {
        int * _pentry;
        size_t _size;
        int _useflag;
        } _HEAPINFO;
#define _HEAPINFO_DEFINED
#endif

/* External variable declarations */

#if !defined(_M_CEE_PURE)
extern _CRT_INSECURE_DEPRECATE_GLOBALS(_get_amblksiz) unsigned int _amblksiz;
#else
_CRT_INSECURE_DEPRECATE_GLOBALS(_get_amblksiz) _CRTIMP unsigned int * __cdecl __p__amblksiz(void);
#define _amblksiz (*__p__amblksiz())
#endif /* !defined(_M_CEE_PURE) */

#define _mm_free(a)      _aligned_free(a)
#define _mm_malloc(a, b)    _aligned_malloc(a, b)

/* Function prototypes */

#if defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC)
#pragma push_macro("calloc")
#pragma push_macro("free")
#pragma push_macro("malloc")
#pragma push_macro("realloc")
#pragma push_macro("_recalloc")
#pragma push_macro("_aligned_free")
#pragma push_macro("_aligned_malloc")
#pragma push_macro("_aligned_offset_malloc")
#pragma push_macro("_aligned_realloc")
#pragma push_macro("_aligned_recalloc")
#pragma push_macro("_aligned_offset_realloc")
#pragma push_macro("_aligned_offset_recalloc")
#pragma push_macro("_aligned_msize")
#pragma push_macro("_freea")
#undef calloc
#undef free
#undef malloc
#undef realloc
#undef _recalloc
#undef _aligned_free
#undef _aligned_malloc
#undef _aligned_offset_malloc
#undef _aligned_realloc
#undef _aligned_recalloc
#undef _aligned_offset_realloc
#undef _aligned_offset_recalloc
#undef _aligned_msize
#undef _freea
#endif

#ifndef _CRT_ALLOCATION_DEFINED
#define _CRT_ALLOCATION_DEFINED
_Check_return_ _Ret_opt_bytecap_x_(_Count*_Size) _CRTIMP _CRT_JIT_INTRINSIC _CRTNOALIAS _CRTRESTRICT    void * __cdecl calloc(_In_ size_t _Count, _In_ size_t _Size);
_CRTIMP                     _CRTNOALIAS                                                                             void   __cdecl free(_Inout_opt_ void * _Memory);
_Check_return_ _Ret_opt_bytecap_(_Size) _CRTIMP _CRT_JIT_INTRINSIC _CRTNOALIAS _CRTRESTRICT                              void * __cdecl malloc(_In_ size_t _Size);
_Check_return_ _Ret_opt_bytecap_(_NewSize) _CRTIMP _CRTNOALIAS _CRTRESTRICT                           void * __cdecl realloc(_In_opt_ void * _Memory, _In_ size_t _NewSize);
_Check_return_ _Ret_opt_bytecap_x_(_Count*_Size) _CRTIMP _CRTNOALIAS _CRTRESTRICT                       void * __cdecl _recalloc(_In_opt_ void * _Memory, _In_ size_t _Count, _In_ size_t _Size);
_CRTIMP                     _CRTNOALIAS                                                                             void   __cdecl _aligned_free(_Inout_opt_ void * _Memory);
_Check_return_ _Ret_opt_bytecap_(_Size) _CRTIMP _CRTNOALIAS _CRTRESTRICT                              void * __cdecl _aligned_malloc(_In_ size_t _Size, _In_ size_t _Alignment);
_Check_return_ _Ret_opt_bytecap_(_Size) _CRTIMP _CRTNOALIAS _CRTRESTRICT                              void * __cdecl _aligned_offset_malloc(_In_ size_t _Size, _In_ size_t _Alignment, _In_ size_t _Offset);
_Check_return_ _Ret_opt_bytecap_(_NewSize) _CRTIMP _CRTNOALIAS _CRTRESTRICT                              void * __cdecl _aligned_realloc(_In_opt_ void * _Memory, _In_ size_t _NewSize, _In_ size_t _Alignment);
_Check_return_ _Ret_opt_bytecap_x_(_Count*_Size) _CRTIMP _CRTNOALIAS _CRTRESTRICT                       void * __cdecl _aligned_recalloc(_In_opt_ void * _Memory, _In_ size_t _Count, _In_ size_t _Size, _In_ size_t _Alignment);
_Check_return_ _Ret_opt_bytecap_(_NewSize) _CRTIMP _CRTNOALIAS _CRTRESTRICT                              void * __cdecl _aligned_offset_realloc(_In_opt_ void * _Memory, _In_ size_t _NewSize, _In_ size_t _Alignment, _In_ size_t _Offset);
_Check_return_ _Ret_opt_bytecap_x_(_Count*_Size) _CRTIMP _CRTNOALIAS _CRTRESTRICT                       void * __cdecl _aligned_offset_recalloc(_In_opt_ void * _Memory, _In_ size_t _Count, _In_ size_t _Size, _In_ size_t _Alignment, _In_ size_t _Offset);
_Check_return_ _CRTIMP                                                  size_t __cdecl _aligned_msize(_In_ void * _Memory, _In_ size_t _Alignment, _In_ size_t _Offset);
#endif

#if defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC)
#pragma pop_macro("calloc")
#pragma pop_macro("free")
#pragma pop_macro("malloc")
#pragma pop_macro("realloc")
#pragma pop_macro("_recalloc")
#pragma pop_macro("_aligned_free")
#pragma pop_macro("_aligned_malloc")
#pragma pop_macro("_aligned_offset_malloc")
#pragma pop_macro("_aligned_realloc")
#pragma pop_macro("_aligned_recalloc")
#pragma pop_macro("_aligned_offset_realloc")
#pragma pop_macro("_aligned_offset_recalloc")
#pragma pop_macro("_aligned_msize")
#pragma pop_macro("_freea")
#endif

_CRTIMP int     __cdecl _resetstkoflw (void);

#define _MAX_WAIT_MALLOC_CRT 60000

_CRTIMP unsigned long __cdecl _set_malloc_crt_max_wait(_In_ unsigned long _NewValue);

#ifndef _POSIX_

#if defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC)
#pragma push_macro("_expand")
#pragma push_macro("_msize")
#undef _expand
#undef _msize
#endif

_Check_return_ _Ret_opt_bytecap_(_NewSize) _CRTIMP void *  __cdecl _expand(_In_opt_ void * _Memory, _In_ size_t _NewSize);
_Check_return_ _CRTIMP size_t  __cdecl _msize(_In_ void * _Memory);

#if defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC)
#pragma pop_macro("_expand")
#pragma pop_macro("_msize")
#endif

_Check_return_ _Ret_bytecap_(_Size) void *          __cdecl _alloca(_In_ size_t _Size);
_Check_return_ _CRTIMP size_t  __cdecl _get_sbh_threshold(void);
_CRTIMP int     __cdecl _set_sbh_threshold(_In_ size_t _NewValue);
_CRTIMP errno_t __cdecl _set_amblksiz(_In_ size_t _Value);
_CRTIMP errno_t __cdecl _get_amblksiz(_Out_ size_t * _Value);
_Check_return_ _CRTIMP int     __cdecl _heapadd(_In_ void * _Memory, _In_ size_t _Size);
_Check_return_ _CRTIMP int     __cdecl _heapchk(void);
_Check_return_ _CRTIMP int     __cdecl _heapmin(void);
_CRTIMP int     __cdecl _heapset(_In_ unsigned int _Fill);
_CRTIMP _CRT_MANAGED_HEAP_DEPRECATE int     __cdecl _heapwalk(_Inout_ _HEAPINFO * _EntryInfo);
_CRTIMP size_t  __cdecl _heapused(size_t * _Used, size_t * _Commit);

_CRTIMP intptr_t __cdecl _get_heap_handle(void);

#define _ALLOCA_S_THRESHOLD     1024
#define _ALLOCA_S_STACK_MARKER  0xCCCC
#define _ALLOCA_S_HEAP_MARKER   0xDDDD

#if defined(_M_IX86)
#define _ALLOCA_S_MARKER_SIZE   8
#elif defined(_M_IA64)
#define _ALLOCA_S_MARKER_SIZE   16
#elif defined(_M_AMD64)
#define _ALLOCA_S_MARKER_SIZE   16
#endif

_STATIC_ASSERT(sizeof(unsigned int) <= _ALLOCA_S_MARKER_SIZE);

#if !defined(__midl) && !defined(RC_INVOKED)
#pragma warning(push)
#pragma warning(disable:6540)
__inline void *_MarkAllocaS(_Out_opt_ __crt_typefix(unsigned int*) void *_Ptr, unsigned int _Marker)
{
    if (_Ptr)
    {
        *((unsigned int*)_Ptr) = _Marker;
        _Ptr = (char*)_Ptr + _ALLOCA_S_MARKER_SIZE;
    }
    return _Ptr;
}
#pragma warning(pop)
#endif

#if defined(_DEBUG)
#if !defined(_CRTDBG_MAP_ALLOC)
#undef _malloca
#define _malloca(size) \
__pragma(warning(suppress: 6255)) \
        _MarkAllocaS(malloc((size) + _ALLOCA_S_MARKER_SIZE), _ALLOCA_S_HEAP_MARKER)
#endif
#else
#undef _malloca
#define _malloca(size) \
__pragma(warning(suppress: 6255)) \
    ((((size) + _ALLOCA_S_MARKER_SIZE) <= _ALLOCA_S_THRESHOLD) ? \
        _MarkAllocaS(_alloca((size) + _ALLOCA_S_MARKER_SIZE), _ALLOCA_S_STACK_MARKER) : \
        _MarkAllocaS(malloc((size) + _ALLOCA_S_MARKER_SIZE), _ALLOCA_S_HEAP_MARKER))
#endif

#undef _FREEA_INLINE
#define _FREEA_INLINE

#ifdef _FREEA_INLINE
/* _freea must be in the header so that its allocator matches _malloca */
#if !defined(__midl) && !defined(RC_INVOKED)
#undef _freea
_CRTNOALIAS __inline void __CRTDECL _freea(_Inout_opt_ void * _Memory)
{
    unsigned int _Marker;
    if (_Memory)
    {
        _Memory = (char*)_Memory - _ALLOCA_S_MARKER_SIZE;
        _Marker = *(unsigned int *)_Memory;
        if (_Marker == _ALLOCA_S_HEAP_MARKER)
        {
            free(_Memory);
        }
#if defined(_ASSERTE)
        else if (_Marker != _ALLOCA_S_STACK_MARKER)
        {
            _ASSERTE(("Corrupted pointer passed to _freea", 0));
        }
#endif
    }
}
#endif
#endif

#if     !__STDC__
/* Non-ANSI names for compatibility */
#define alloca  _alloca
#endif  /* __STDC__*/

#endif  /* _POSIX_ */

#ifdef  HEAPHOOK
#ifndef _HEAPHOOK_DEFINED
/* hook function type */
typedef int (__cdecl * _HEAPHOOK)(int, size_t, void *, void **);
#define _HEAPHOOK_DEFINED
#endif  /* _HEAPHOOK_DEFINED */

/* set hook function */
_CRTIMP _HEAPHOOK __cdecl _setheaphook(_In_opt_ _HEAPHOOK _NewHook);

/* hook function must handle these types */
#define _HEAP_MALLOC    1
#define _HEAP_CALLOC    2
#define _HEAP_FREE      3
#define _HEAP_REALLOC   4
#define _HEAP_MSIZE     5
#define _HEAP_EXPAND    6
#endif  /* HEAPHOOK */


#ifdef  __cplusplus
}
#endif

#ifdef  _MSC_VER
#pragma pack(pop)
#endif  /* _MSC_VER */

#endif  /* _INC_MALLOC */
0