Changeset 1103:d8591b1c56cd in freeDiameter for libfdproto/messages.c
- Timestamp:
- May 10, 2013, 7:48:57 PM (11 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libfdproto/messages.c
r1101 r1103 202 202 init_chain( &msg->msg_chain, MSG_MSG); 203 203 msg->msg_eyec = MSG_MSG_EYEC; 204 205 fd_list_init(&msg->msg_pmdl.sentinel, NULL); 206 CHECK_POSIX_DO( pthread_mutex_init(&msg->msg_pmdl.lock, NULL), ); 204 207 } 205 208 … … 1952 1955 CHECK_PARAMS( buffer && *buffer && msg && (buflen >= GETMSGHDRSZ()) ); 1953 1956 buf = *buffer; 1954 *buffer = NULL;1955 1957 1956 1958 if ( buf[0] != DIAMETER_VERSION) { 1957 1959 TRACE_DEBUG(INFO, "Invalid version in message: %d (supported: %d)", buf[0], DIAMETER_VERSION); 1958 free(buf);1959 1960 return EBADMSG; 1960 1961 } … … 1963 1964 if ( buflen < msglen ) { 1964 1965 TRACE_DEBUG(INFO, "Truncated message (%zd / %d)", buflen, msglen ); 1965 free(buf);1966 1966 return EBADMSG; 1967 1967 } 1968 1968 1969 1969 /* Create a new object */ 1970 CHECK_MALLOC _DO( new = malloc (sizeof(struct msg)), { free(buf); return ENOMEM; });1970 CHECK_MALLOC( new = malloc (sizeof(struct msg)) ); 1971 1971 1972 1972 /* Initialize the fields */ … … 1984 1984 new->msg_public.msg_eteid = ntohl(*(uint32_t *)(buf+16)); 1985 1985 1986 new->msg_rawbuffer = buf;1987 1988 1986 /* Parse the AVP list */ 1989 1987 CHECK_FCT_DO( ret = parsebuf_list(buf + GETMSGHDRSZ(), buflen - GETMSGHDRSZ(), &new->msg_chain.children), { destroy_tree(_C(new)); return ret; } ); 1990 1988 1989 /* Parsing successful */ 1990 new->msg_rawbuffer = buf; 1991 *buffer = NULL; 1991 1992 *msg = new; 1992 1993 return 0;
Note: See TracChangeset
for help on using the changeset viewer.