Changeset 752:9e9840ccf059 in freeDiameter
- Timestamp:
- Sep 24, 2011, 4:45:14 PM (13 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- libfdproto
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
libfdproto/messages.c
r740 r752 1771 1771 } ); 1772 1772 avp->avp_storage.os.len = avp->avp_public.avp_len - GETAVPHDRSZ( avp->avp_public.avp_flags ); 1773 if (avp->avp_storage.os.len) { 1774 CHECK_MALLOC( avp->avp_storage.os.data = os0dup(avp->avp_source, avp->avp_storage.os.len) ); 1775 avp->avp_mustfreeos = 1; 1776 } else { 1777 avp->avp_storage.os.data = NULL; 1778 } 1773 CHECK_MALLOC( avp->avp_storage.os.data = os0dup(avp->avp_source, avp->avp_storage.os.len) ); 1774 avp->avp_mustfreeos = 1; 1779 1775 break; 1780 1776 -
libfdproto/ostr.c
r743 r752 45 45 os0_t r; 46 46 CHECK_MALLOC_DO( r = malloc(l+1), return NULL ); 47 memcpy(r, s, l); /* this might be faster than a strcpy or strdup because it can work with 32 or 64b blocks */ 47 if (l) 48 memcpy(r, s, l); /* this might be faster than a strcpy or strdup because it can work with 32 or 64b blocks */ 48 49 r[l] = '\0'; 49 50 return r; … … 58 59 if (os1sz > os2sz) 59 60 return 1; 60 return memcmp(os1, os2, os1sz);61 return os1sz ? memcmp(os1, os2, os1sz) : 0; 61 62 } 62 63
Note: See TracChangeset
for help on using the changeset viewer.