Skip to content

Commit

Permalink
Fix potential null pointer dereference in src/classdef.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
orbitcowboy committed Dec 22, 2014
1 parent ed39dab commit 5743848
Showing 1 changed file with 21 additions and 20 deletions.
41 changes: 21 additions & 20 deletions src/classdef.cpp
Expand Up @@ -3123,18 +3123,19 @@ void ClassDef::mergeCategory(ClassDef *category)
Protection prot = mi->prot;
//if (makePrivate) prot = Private;
MemberDef *newMd = mi->memberDef->deepCopy();
//printf("Copying member %s\n",mi->memberDef->name().data());
newMd->moveTo(this);

MemberInfo *newMi=new MemberInfo(newMd,prot,mi->virt,mi->inherited);
newMi->scopePath=mi->scopePath;
newMi->ambigClass=mi->ambigClass;
newMi->ambiguityResolutionScope=mi->ambiguityResolutionScope;
newMni->append(newMi);

// also add the newly created member to the global members list
if (newMd)
{
//printf("Copying member %s\n",mi->memberDef->name().data());
newMd->moveTo(this);

MemberInfo *newMi=new MemberInfo(newMd,prot,mi->virt,mi->inherited);
newMi->scopePath=mi->scopePath;
newMi->ambigClass=mi->ambigClass;
newMi->ambiguityResolutionScope=mi->ambiguityResolutionScope;
newMni->append(newMi);

// also add the newly created member to the global members list

MemberName *mn;
QCString name = newMd->name();
if ((mn=Doxygen::memberNameSDict->find(name)))
Expand All @@ -3147,17 +3148,17 @@ void ClassDef::mergeCategory(ClassDef *category)
mn->append(newMd);
Doxygen::memberNameSDict->append(name,mn);
}

newMd->setCategory(category);
newMd->setCategoryRelation(mi->memberDef);
mi->memberDef->setCategoryRelation(newMd);
if (makePrivate || isExtension)
{
newMd->makeImplementationDetail();
}
internalInsertMember(newMd,prot,FALSE);
}

newMd->setCategory(category);
newMd->setCategoryRelation(mi->memberDef);
mi->memberDef->setCategoryRelation(newMd);
if (makePrivate || isExtension)
{
newMd->makeImplementationDetail();
}
internalInsertMember(newMd,prot,FALSE);
}
}

// add it to the dictionary
dstMnd->append(newMni->memberName(),newMni);
Expand Down

0 comments on commit 5743848

Please sign in to comment.