From Evan Huus:
Fix Three memory leaks and a bad if-condition, as caught by CppCheck. https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7272 svn path=/trunk/; revision=42738
This commit is contained in:
parent
35dd3b052e
commit
fec821f303
|
@ -317,7 +317,7 @@ WSLUA_METHOD ProgDlg_update(lua_State* L) { /* Appends text */
|
|||
WSLUA_ERROR(ProgDlg_update,"Cannot be called for something not a ProgDlg");
|
||||
} */
|
||||
|
||||
if (pr >= 0.0 || pr <= 1.0) {
|
||||
if (pr >= 0.0 && pr <= 1.0) {
|
||||
ops->update_progress(pd->pw, (float) pr, task);
|
||||
} else {
|
||||
WSLUA_ERROR(ProgDlg_update,"Progress value out of range (must be between 0.0 and 1.0)");
|
||||
|
|
|
@ -1222,7 +1222,7 @@ typedef struct _pinfo_method_t {
|
|||
|
||||
static int Pinfo_hi(lua_State *L) {
|
||||
Pinfo pinfo = checkPinfo(L,1);
|
||||
Address addr = g_malloc(sizeof(address));
|
||||
Address addr;
|
||||
|
||||
if (!pinfo) return 0;
|
||||
if (pinfo->expired) {
|
||||
|
@ -1230,6 +1230,7 @@ static int Pinfo_hi(lua_State *L) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
addr = g_malloc(sizeof(address));
|
||||
if (CMP_ADDRESS(&(pinfo->ws_pinfo->src), &(pinfo->ws_pinfo->dst) ) >= 0) {
|
||||
COPY_ADDRESS(addr, &(pinfo->ws_pinfo->src));
|
||||
} else {
|
||||
|
@ -1242,7 +1243,7 @@ static int Pinfo_hi(lua_State *L) {
|
|||
|
||||
static int Pinfo_lo(lua_State *L) {
|
||||
Pinfo pinfo = checkPinfo(L,1);
|
||||
Address addr = g_malloc(sizeof(address));
|
||||
Address addr;
|
||||
|
||||
if (!pinfo) return 0;
|
||||
if (pinfo->expired) {
|
||||
|
@ -1250,6 +1251,7 @@ static int Pinfo_lo(lua_State *L) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
addr = g_malloc(sizeof(address));
|
||||
if (CMP_ADDRESS(&(pinfo->ws_pinfo->src), &(pinfo->ws_pinfo->dst) ) < 0) {
|
||||
COPY_ADDRESS(addr, &(pinfo->ws_pinfo->src));
|
||||
} else {
|
||||
|
|
|
@ -1574,9 +1574,6 @@ WSLUA_CONSTRUCTOR DissectorTable_new (lua_State *L) {
|
|||
|
||||
if(!(name && ui_name)) return 0;
|
||||
|
||||
name = g_strdup(name);
|
||||
ui_name = g_strdup(ui_name);
|
||||
|
||||
switch(type) {
|
||||
case FT_STRING:
|
||||
base = BASE_NONE;
|
||||
|
@ -1587,6 +1584,9 @@ WSLUA_CONSTRUCTOR DissectorTable_new (lua_State *L) {
|
|||
{
|
||||
DissectorTable dt = g_malloc(sizeof(struct _wslua_distbl_t));
|
||||
|
||||
name = g_strdup(name);
|
||||
ui_name = g_strdup(ui_name);
|
||||
|
||||
dt->table = register_dissector_table(name, ui_name, type, base);
|
||||
dt->name = name;
|
||||
pushDissectorTable(L, dt);
|
||||
|
|
Loading…
Reference in New Issue