free overwritten dpd values

git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@12825 67ed7778-7388-44ab-90cf-0a291f65f57c
This commit is contained in:
Marcus Meissner
2010-03-21 10:18:52 +00:00
parent 6b6dea01be
commit e4f5fe82b5

View File

@@ -1356,6 +1356,7 @@ ptp_unpack_CANON_changes (PTPParams *params, unsigned char* data, int datasize,
i, propxtype, proptype, dpd->DataType, propxcnt);
dpd->FormFlag = PTP_DPFF_Enumeration;
dpd->FORM.Enum.NumberOfValues = propxcnt;
if (dpd->FORM.Enum.SupportedValue) free (dpd->FORM.Enum.SupportedValue);
dpd->FORM.Enum.SupportedValue = malloc (sizeof (PTPPropertyValue)*propxcnt);
switch (proptype) {
@@ -1609,7 +1610,10 @@ ptp_unpack_CANON_changes (PTPParams *params, unsigned char* data, int datasize,
dpd->FactoryDefaultValue.str = ptp_unpack_string(params, data, 0, &len);
dpd->CurrentValue.str = ptp_unpack_string(params, data, 0, &len);
#else
if (dpd->FactoryDefaultValue.str) free (dpd->FactoryDefaultValue.str);
dpd->FactoryDefaultValue.str = strdup( (char*)data );
if (dpd->CurrentValue.str) free (dpd->CurrentValue.str);
dpd->CurrentValue.str = strdup( (char*)data );
#endif
ptp_debug (params,"event %d: currentvalue of %x is %s", i, proptype, dpd->CurrentValue.str);