Skip to content

Commit

Permalink
htable: release pkg memory before returning
Browse files Browse the repository at this point in the history
resets 'first' when esize == 0

(cherry picked from commit 2d771f5)
  • Loading branch information
lazedo committed Jun 2, 2017
1 parent 6c777c2 commit 43a9739
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/modules/htable/ht_var.c
Expand Up @@ -48,17 +48,17 @@ int pv_get_ht_cell(struct sip_msg *msg, pv_param_t *param,
return -1;
}
htc = ht_cell_pkg_copy(hpv->ht, &htname, _htc_local);
if(_htc_local!=htc)
{
ht_cell_pkg_free(_htc_local);
_htc_local=htc;
}
if(htc==NULL)
{
if(hpv->ht->flags==PV_VAL_INT)
return pv_get_sintval(msg, param, res, hpv->ht->initval.n);
return pv_get_null(msg, param, res);
}
if(_htc_local!=htc)
{
ht_cell_pkg_free(_htc_local);
_htc_local=htc;
}

if(htc->flags&AVP_VAL_STR)
return pv_get_strval(msg, param, res, &htc->value.s);
Expand Down Expand Up @@ -326,15 +326,15 @@ int pv_get_ht_add(struct sip_msg *msg, pv_param_t *param,
return -1;
}
htc = ht_cell_value_add(hpv->ht, &htname, val, 1, _htc_local);
if(htc==NULL)
{
return pv_get_null(msg, param, res);
}
if(_htc_local!=htc)
{
ht_cell_pkg_free(_htc_local);
_htc_local=htc;
}
if(htc==NULL)
{
return pv_get_null(msg, param, res);
}

if(htc->flags&AVP_VAL_STR)
return pv_get_null(msg, param, res);
Expand Down

0 comments on commit 43a9739

Please sign in to comment.