Fix memory leak on getPidTagSubject

Valgrind crafted report:

=40967== 128,927 (53,750 direct, 75,177 indirect) bytes in 383 blocks are definitely lost in loss record 10,104 of 10,179
==40967==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==40967==    by 0x86EDE3D: talloc_strndup (talloc.c:613)
==40967==    by 0x34D2BB9E: _i_NSString_MAPIStoreDataTypes_asUnicodeInMemCtx_ (in /usr/lib/GNUstep/SOGo/SOGoBackend.MAPIStore/SOGoBackend)
==40967==    by 0x34D2025B: _i_MAPIStoreMailMessage__getPidTagNormalizedSubject_inMemCtx_ (in /usr/lib/GNUstep/SOGo/SOGoBackend.MAPIStore/SOGoBackend)
==40967==    by 0x34CFCD40: _i_MAPIStoreObject__getProperty_withTag_inMemCtx_ (in /usr/lib/GNUstep/SOGo/SOGoBackend.MAPIStore/SOGoBackend)
==40967==    by 0x34CFBE21: _i_MAPIStoreMessage__getPidTagSubject_inMemCtx_ (in /usr/lib/GNUstep/SOGo/SOGoBackend.MAPIStore/SOGoBackend)
==40967==    by 0x34CFBEB6: _i_MAPIStoreMessage__getPidTagOriginalSubject_inMemCtx_ (in /usr/lib/GNUstep/SOGo/SOGoBackend.MAPIStore/SOGoBackend)
==40967==    by 0x34CFCD40: _i_MAPIStoreObject__getProperty_withTag_inMemCtx_ (in /usr/lib/GNUstep/SOGo/SOGoBackend.MAPIStore/SOGoBackend)
==40967==    by 0x34CFD07E: _i_MAPIStoreObject__getProperties_withTags_andCount_inMemCtx_ (in /usr/lib/GNUstep/SOGo/SOGoBackend.MAPIStore/SOGoBackend)
pull/69/head
Enrique J. Hernández Blasco 2014-11-26 09:20:45 +01:00
parent a8b716fbaa
commit f4e15e2db8
1 changed files with 3 additions and 1 deletions

View File

@ -795,7 +795,7 @@ rtf2html (NSData *compressedRTF)
TALLOC_CTX *localMemCtx;
char *prefix, *normalizedSubject;
localMemCtx = talloc_zero (NULL, TALLOC_CTX);
localMemCtx = talloc_zero (memCtx, TALLOC_CTX);
if ([self getProperty: (void **) &prefix
withTag: PidTagSubjectPrefix
inMemCtx: localMemCtx]
@ -807,6 +807,8 @@ rtf2html (NSData *compressedRTF)
if (rc == MAPISTORE_SUCCESS)
*data = talloc_asprintf (memCtx, "%s%s", prefix, normalizedSubject);
talloc_free(localMemCtx);
return rc;
}