From e4f5fe82b5dd0b0912fe1bcb3611e3fb080cec6e Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Sun, 21 Mar 2010 10:18:52 +0000 Subject: [PATCH] free overwritten dpd values git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@12825 67ed7778-7388-44ab-90cf-0a291f65f57c --- camlibs/ptp2/ptp-pack.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/camlibs/ptp2/ptp-pack.c b/camlibs/ptp2/ptp-pack.c index 3b3425a51..05dab7b7a 100644 --- a/camlibs/ptp2/ptp-pack.c +++ b/camlibs/ptp2/ptp-pack.c @@ -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);