Remove a casting-away-constness warning.

Keep the pointer to the allocated data in a non-const pointer, and free
it using *that* pointer.

Change-Id: I7d29b6768be58ed0181cd64c68ac0b7d03ec5611
Reviewed-on: https://code.wireshark.org/review/25954
Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
Guy Harris 2018-02-20 18:16:57 -08:00
parent 65aa59d28a
commit dc1ab9f32b
1 changed files with 12 additions and 8 deletions

View File

@ -624,24 +624,28 @@ static void register_mibs(void) {
if ( typedata && oid_data->value_hfid == -2 ) {
SmiNamedNumber* smiEnum;
hf_register_info hf;
char *name;
char *blurb;
name = g_strdup(oid_data->name);
blurb = smiRenderOID(smiNode->oidlen, smiNode->oid, SMI_RENDER_ALL);
/* Don't allow duplicate blurb/name */
if (strcmp(blurb, name) == 0) {
smi_free(blurb);
blurb = NULL;
}
hf.p_id = &(oid_data->value_hfid);
hf.hfinfo.name = g_strdup(oid_data->name);
hf.hfinfo.name = name;
hf.hfinfo.abbrev = alnumerize(oid_data->name);
hf.hfinfo.type = typedata->ft_type;
hf.hfinfo.display = typedata->display;
hf.hfinfo.strings = NULL;
hf.hfinfo.bitmask = 0;
hf.hfinfo.blurb = smiRenderOID(smiNode->oidlen, smiNode->oid, SMI_RENDER_ALL);
hf.hfinfo.blurb = blurb;
/* HFILL */
HFILL_INIT(hf);
/* Don't allow duplicate blurb/name */
if (strcmp(hf.hfinfo.blurb, hf.hfinfo.name) == 0) {
smi_free((void *) hf.hfinfo.blurb);
hf.hfinfo.blurb = NULL;
}
oid_data->value_hfid = -1;
if ( IS_ENUMABLE(hf.hfinfo.type) && (smiEnum = smiGetFirstNamedNumber(smiType))) {