に変更されている私は、この警告と奇妙なバグを取得しています。 次の構造体のrmi_pduには、可変サイズの配列が含まれています。 これに関する情報は高く評価されています。は、次の警告ばかり:私は試してみて、私のプログラムを実行するときに柔軟な配列メンバーと構造体を渡すのABIは、GCC 4.4
struct rmi_message_s { /* Queue element containing Rmi message */
struct rmi_message_s *hnext;
struct rmi_message_s *hprev;
uint16_t gen_counter; /* Generation counter */
time_value send_time;
uint8_t retry_count;
TAILQ_ENTRY(rmi_message_s) rmi_message_next;
rmi_message_pdu rmi_pdu; /* contains a variable sized array */
};
typedef struct {
uint16_t zero;
uint16_t type;
uint8_t version;
uint8_t len;
uint8_t protocol;
uint16_t edge_port;
uint16_t core_port;
uint32_t connexus_id;
pi_ipv4_addr_t edge_addr;
pi_ipv4_addr_t core_addr;
uint16_t gen_count; /* Integer to identify a stale packet */
uint8_t payload[];
} rmi_message_pdu;
問題は、私が動的に割り当てるメモリを解放しようとしているときです。内容はそこにありますが、free()APIはabort()です。これは、割り当てが RMIを使用したい、発信者のように見えるものである
in raise() from /lib64/libc.so.6
in abort() from /lib64/libc.so.6
in __libc_message() from /lib64/libc.so.6
in _int_free() from /lib64/libc.so.6
in free() from /lib64/libc.so.6
in free (p=0x2aaabc000fa0) at mallocdbg.cc:188
in rmi_hash_cleanup (rmi_msg=0x2aaabc000fa0) at tcpsvc_rmi.c:126
in rmi_process_response (response_packet=0x27422e00) at tcpsvc_rmi.c:239
in rmi_message_handle (pkt=0x27422e00 "", cnt=28) at tcpsvc_base.c:154
in udpif_worker (arg=0x2b01f7014340) at rumpnet_virtif/if_udp_netbsd_guest.c:573
in threadbouncer (arg=0x2b01f7016428) at rumpkern/emul.c:428
in clone() from /lib64/libc.so.6
のように、この何コアが見え、引数としてサイズを渡します。
struct rmi_message_s *rmi_msg ;
rmi_msg = (struct rmi_message_s *) malloc
(sizeof(struct rmi_message_s *) + len * sizeof(uint8_t));
lenが引数として渡されます。
されている必要がありますそこから/へ)? – derobert
GCC 4.4以降を使用してプロジェクト全体を再構築しましたか?その警告は、あなたのコードのいくつかが古いバージョンのGCCを使ってコンパイルされ、あなたのコードのいくつかが新しいバージョンを使ってコンパイルされている場合にのみ関連しているはずです。もしそうでないなら、問題は他のものです。 – ruakh
どのように 'rmi_message_pdu'を割り当てていますか?割り当てするサイズはどうやって計算していますか? – MSN