Follow-up to r17351 - Fixed memory leaks. Thanks Lighta and Lemongrass for helping!

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@17388 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
akinari1087 2013-06-27 05:28:47 +00:00
parent 78eb7d3793
commit c6aa4f8fe3

View File

@ -296,9 +296,13 @@ int mapif_parse_itembound_retrieve(int fd)
i++; i++;
} }
} }
Sql_FreeResult(sql_handle);
if(!i) //No items found - No need to continue if(!i) { //No items found - No need to continue
StringBuf_Destroy(&buf);
SqlStmt_Free(stmt);
return 0; return 0;
}
//First we delete the character's items //First we delete the character's items
StringBuf_Clear(&buf); StringBuf_Clear(&buf);
@ -311,7 +315,6 @@ int mapif_parse_itembound_retrieve(int fd)
StringBuf_Printf(&buf, " `id`=%d",items[j].id); StringBuf_Printf(&buf, " `id`=%d",items[j].id);
} }
stmt = SqlStmt_Malloc(sql_handle);
if( SQL_ERROR == SqlStmt_PrepareStr(stmt, StringBuf_Value(&buf)) if( SQL_ERROR == SqlStmt_PrepareStr(stmt, StringBuf_Value(&buf))
|| SQL_ERROR == SqlStmt_Execute(stmt) ) || SQL_ERROR == SqlStmt_Execute(stmt) )
{ {
@ -342,7 +345,6 @@ int mapif_parse_itembound_retrieve(int fd)
StringBuf_AppendStr(&buf, ")"); StringBuf_AppendStr(&buf, ")");
} }
stmt = SqlStmt_Malloc(sql_handle);
if( SQL_ERROR == SqlStmt_PrepareStr(stmt, StringBuf_Value(&buf)) if( SQL_ERROR == SqlStmt_PrepareStr(stmt, StringBuf_Value(&buf))
|| SQL_ERROR == SqlStmt_Execute(stmt) ) || SQL_ERROR == SqlStmt_Execute(stmt) )
{ {
@ -352,6 +354,9 @@ int mapif_parse_itembound_retrieve(int fd)
return 1; return 1;
} }
StringBuf_Destroy(&buf);
SqlStmt_Free(stmt);
//Finally reload storage and tell map we're done //Finally reload storage and tell map we're done
mapif_load_guild_storage(fd,aid,guild_id,0); mapif_load_guild_storage(fd,aid,guild_id,0);
mapif_itembound_ack(fd,aid,guild_id); mapif_itembound_ack(fd,aid,guild_id);