[S] Change in libosmocore[master]: ipa_ccm_tlv_to_unitdata(): free previous string if present before all...
pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/35347?usp=email ) Change subject: ipa_ccm_tlv_to_unitdata(): free previous string if present before allocating new one .. ipa_ccm_tlv_to_unitdata(): free previous string if present before allocating new one Change-Id: I66cbd900676875145810ad1d5c07e719311852fb --- M src/gsm/ipa.c 1 file changed, 30 insertions(+), 12 deletions(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved daniel: Looks good to me, but someone else must approve osmith: Looks good to me, but someone else must approve diff --git a/src/gsm/ipa.c b/src/gsm/ipa.c index cd95c6b..6e41fd9 100644 --- a/src/gsm/ipa.c +++ b/src/gsm/ipa.c @@ -267,34 +267,43 @@ return 0; } +/*! Fill ud struct from tp structure. + * \param[in,out] ud ipaccess_unit to fill + * \param[in] tp the decoded TLV structure from eg. ID_RESP message + * \returns zero on success, negative on error + * + * This function expects parameter ud's fields to be initialized to zero if not yet set. + * Existing incoming string pointer fields are expected to be allocated using + * talloc and will be deallocated as such if replaced with the content of tp. + **/ int ipa_ccm_tlv_to_unitdata(struct ipaccess_unit *ud, const struct tlv_parsed *tp) { int rc = 0; if (TLVP_PRES_LEN(tp, IPAC_IDTAG_SERNR, 1)) - ud->serno = talloc_strdup(ud, (char *) - TLVP_VAL(tp, IPAC_IDTAG_SERNR)); + osmo_talloc_replace_string(ud, >serno, + (char *)TLVP_VAL(tp, IPAC_IDTAG_SERNR)); if (TLVP_PRES_LEN(tp, IPAC_IDTAG_UNITNAME, 1)) - ud->unit_name = talloc_strdup(ud, (char *) - TLVP_VAL(tp, IPAC_IDTAG_UNITNAME)); + osmo_talloc_replace_string(ud, >unit_name, + (char *)TLVP_VAL(tp, IPAC_IDTAG_UNITNAME)); if (TLVP_PRES_LEN(tp, IPAC_IDTAG_LOCATION1, 1)) - ud->location1 = talloc_strdup(ud, (char *) - TLVP_VAL(tp, IPAC_IDTAG_LOCATION1)); + osmo_talloc_replace_string(ud, >location1, + (char *)TLVP_VAL(tp, IPAC_IDTAG_LOCATION1)); if (TLVP_PRES_LEN(tp, IPAC_IDTAG_LOCATION2, 1)) - ud->location2 = talloc_strdup(ud, (char *) - TLVP_VAL(tp, IPAC_IDTAG_LOCATION2)); + osmo_talloc_replace_string(ud, >location2, + (char *)TLVP_VAL(tp, IPAC_IDTAG_LOCATION2)); if (TLVP_PRES_LEN(tp, IPAC_IDTAG_EQUIPVERS, 1)) - ud->equipvers = talloc_strdup(ud, (char *) - TLVP_VAL(tp, IPAC_IDTAG_EQUIPVERS)); + osmo_talloc_replace_string(ud, >equipvers, + (char *)TLVP_VAL(tp, IPAC_IDTAG_EQUIPVERS)); if (TLVP_PRES_LEN(tp, IPAC_IDTAG_SWVERSION, 1)) - ud->swversion = talloc_strdup(ud, (char *) - TLVP_VAL(tp, IPAC_IDTAG_SWVERSION)); + osmo_talloc_replace_string(ud, >swversion, + (char *)TLVP_VAL(tp, IPAC_IDTAG_SWVERSION)); if (TLVP_PRES_LEN(tp, IPAC_IDTAG_MACADDR, 17)) { rc = osmo_macaddr_parse(ud->mac_addr, (char *) -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/35347?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I66cbd900676875145810ad1d5c07e719311852fb Gerrit-Change-Number: 35347 Gerrit-PatchSet: 3 Gerrit-Owner: pespin Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel Gerrit-Reviewer: fixeria Gerrit-Reviewer: laforge Gerrit-Reviewer: osmith Gerrit-Reviewer: pespin Gerrit-MessageType: merged
[S] Change in libosmocore[master]: ipa_ccm_tlv_to_unitdata(): free previous string if present before all...
Attention is currently required from: fixeria, pespin. laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/35347?usp=email ) Change subject: ipa_ccm_tlv_to_unitdata(): free previous string if present before allocating new one .. Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/35347?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I66cbd900676875145810ad1d5c07e719311852fb Gerrit-Change-Number: 35347 Gerrit-PatchSet: 2 Gerrit-Owner: pespin Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel Gerrit-Reviewer: fixeria Gerrit-Reviewer: laforge Gerrit-Reviewer: osmith Gerrit-Attention: pespin Gerrit-Attention: fixeria Gerrit-Comment-Date: Thu, 14 Dec 2023 15:03:47 + Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
[S] Change in libosmocore[master]: ipa_ccm_tlv_to_unitdata(): free previous string if present before all...
Attention is currently required from: fixeria, laforge, pespin. daniel has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/35347?usp=email ) Change subject: ipa_ccm_tlv_to_unitdata(): free previous string if present before allocating new one .. Patch Set 2: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/35347?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I66cbd900676875145810ad1d5c07e719311852fb Gerrit-Change-Number: 35347 Gerrit-PatchSet: 2 Gerrit-Owner: pespin Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel Gerrit-Reviewer: fixeria Gerrit-Reviewer: laforge Gerrit-Reviewer: osmith Gerrit-Attention: laforge Gerrit-Attention: pespin Gerrit-Attention: fixeria Gerrit-Comment-Date: Thu, 14 Dec 2023 13:26:51 + Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
[S] Change in libosmocore[master]: ipa_ccm_tlv_to_unitdata(): free previous string if present before all...
Attention is currently required from: daniel, fixeria, laforge, pespin. osmith has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/35347?usp=email ) Change subject: ipa_ccm_tlv_to_unitdata(): free previous string if present before allocating new one .. Patch Set 2: Code-Review+1 (1 comment) File src/gsm/ipa.c: https://gerrit.osmocom.org/c/libosmocore/+/35347/comment/3d3ede45_86ad20b5 PS1, Line 271: in > actually, `out` or even `inout` Done -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/35347?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I66cbd900676875145810ad1d5c07e719311852fb Gerrit-Change-Number: 35347 Gerrit-PatchSet: 2 Gerrit-Owner: pespin Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel Gerrit-Reviewer: fixeria Gerrit-Reviewer: laforge Gerrit-Reviewer: osmith Gerrit-Attention: laforge Gerrit-Attention: pespin Gerrit-Attention: fixeria Gerrit-Attention: daniel Gerrit-Comment-Date: Thu, 14 Dec 2023 13:16:30 + Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Comment-In-Reply-To: fixeria Gerrit-MessageType: comment
[S] Change in libosmocore[master]: ipa_ccm_tlv_to_unitdata(): free previous string if present before all...
Attention is currently required from: fixeria, laforge, pespin. Hello Jenkins Builder, fixeria, laforge, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/libosmocore/+/35347?usp=email to look at the new patch set (#2). The following approvals got outdated and were removed: Code-Review+1 by fixeria, Verified+1 by Jenkins Builder Change subject: ipa_ccm_tlv_to_unitdata(): free previous string if present before allocating new one .. ipa_ccm_tlv_to_unitdata(): free previous string if present before allocating new one Change-Id: I66cbd900676875145810ad1d5c07e719311852fb --- M src/gsm/ipa.c 1 file changed, 30 insertions(+), 12 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/47/35347/2 -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/35347?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I66cbd900676875145810ad1d5c07e719311852fb Gerrit-Change-Number: 35347 Gerrit-PatchSet: 2 Gerrit-Owner: pespin Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria Gerrit-Reviewer: laforge Gerrit-Attention: laforge Gerrit-Attention: fixeria Gerrit-Attention: pespin Gerrit-MessageType: newpatchset
[S] Change in libosmocore[master]: ipa_ccm_tlv_to_unitdata(): free previous string if present before all...
Attention is currently required from: laforge, pespin. fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/35347?usp=email ) Change subject: ipa_ccm_tlv_to_unitdata(): free previous string if present before allocating new one .. Patch Set 1: Code-Review+1 (1 comment) File src/gsm/ipa.c: https://gerrit.osmocom.org/c/libosmocore/+/35347/comment/c56b7091_e5d3d24b PS1, Line 271: in actually, `out` or even `inout` -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/35347?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I66cbd900676875145810ad1d5c07e719311852fb Gerrit-Change-Number: 35347 Gerrit-PatchSet: 1 Gerrit-Owner: pespin Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria Gerrit-Reviewer: laforge Gerrit-Attention: laforge Gerrit-Attention: pespin Gerrit-Comment-Date: Wed, 13 Dec 2023 02:40:26 + Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
[S] Change in libosmocore[master]: ipa_ccm_tlv_to_unitdata(): free previous string if present before all...
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/35347?usp=email ) Change subject: ipa_ccm_tlv_to_unitdata(): free previous string if present before allocating new one .. ipa_ccm_tlv_to_unitdata(): free previous string if present before allocating new one Change-Id: I66cbd900676875145810ad1d5c07e719311852fb --- M src/gsm/ipa.c 1 file changed, 28 insertions(+), 12 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/47/35347/1 diff --git a/src/gsm/ipa.c b/src/gsm/ipa.c index cd95c6b..40d7098 100644 --- a/src/gsm/ipa.c +++ b/src/gsm/ipa.c @@ -267,34 +267,41 @@ return 0; } +/*! Fill ud struct from tp structure. + * \param[in] ud ipaccess_unit to fill + * \param[in] tp the decoded TLV structure from eg. ID_RESP message + * \returns zero on success, negative on error + * + * This function expects parameter ud's fields to be initialized to zero if not yet set. + **/ int ipa_ccm_tlv_to_unitdata(struct ipaccess_unit *ud, const struct tlv_parsed *tp) { int rc = 0; if (TLVP_PRES_LEN(tp, IPAC_IDTAG_SERNR, 1)) - ud->serno = talloc_strdup(ud, (char *) - TLVP_VAL(tp, IPAC_IDTAG_SERNR)); + osmo_talloc_replace_string(ud, >serno, + (char *)TLVP_VAL(tp, IPAC_IDTAG_SERNR)); if (TLVP_PRES_LEN(tp, IPAC_IDTAG_UNITNAME, 1)) - ud->unit_name = talloc_strdup(ud, (char *) - TLVP_VAL(tp, IPAC_IDTAG_UNITNAME)); + osmo_talloc_replace_string(ud, >unit_name, + (char *)TLVP_VAL(tp, IPAC_IDTAG_UNITNAME)); if (TLVP_PRES_LEN(tp, IPAC_IDTAG_LOCATION1, 1)) - ud->location1 = talloc_strdup(ud, (char *) - TLVP_VAL(tp, IPAC_IDTAG_LOCATION1)); + osmo_talloc_replace_string(ud, >location1, + (char *)TLVP_VAL(tp, IPAC_IDTAG_LOCATION1)); if (TLVP_PRES_LEN(tp, IPAC_IDTAG_LOCATION2, 1)) - ud->location2 = talloc_strdup(ud, (char *) - TLVP_VAL(tp, IPAC_IDTAG_LOCATION2)); + osmo_talloc_replace_string(ud, >location2, + (char *)TLVP_VAL(tp, IPAC_IDTAG_LOCATION2)); if (TLVP_PRES_LEN(tp, IPAC_IDTAG_EQUIPVERS, 1)) - ud->equipvers = talloc_strdup(ud, (char *) - TLVP_VAL(tp, IPAC_IDTAG_EQUIPVERS)); + osmo_talloc_replace_string(ud, >equipvers, + (char *)TLVP_VAL(tp, IPAC_IDTAG_EQUIPVERS)); if (TLVP_PRES_LEN(tp, IPAC_IDTAG_SWVERSION, 1)) - ud->swversion = talloc_strdup(ud, (char *) - TLVP_VAL(tp, IPAC_IDTAG_SWVERSION)); + osmo_talloc_replace_string(ud, >swversion, + (char *)TLVP_VAL(tp, IPAC_IDTAG_SWVERSION)); if (TLVP_PRES_LEN(tp, IPAC_IDTAG_MACADDR, 17)) { rc = osmo_macaddr_parse(ud->mac_addr, (char *) -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/35347?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I66cbd900676875145810ad1d5c07e719311852fb Gerrit-Change-Number: 35347 Gerrit-PatchSet: 1 Gerrit-Owner: pespin Gerrit-MessageType: newchange