diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-07-14 22:19:51 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-14 22:19:51 +0300 |
commit | 79ea125f00a9655ee3aea7c784bd012888f39cf6 (patch) | |
tree | 1825fec0dabf8fdb06cc578e640825bae93048f1 /src/map/guild.c | |
parent | b89dd1428b2d357c8bbe016573fb0ab25ade2782 (diff) | |
parent | 6c0b298c869913105e4c4d29a6580bf68cd89f55 (diff) | |
download | hercules-79ea125f00a9655ee3aea7c784bd012888f39cf6.tar.gz hercules-79ea125f00a9655ee3aea7c784bd012888f39cf6.tar.bz2 hercules-79ea125f00a9655ee3aea7c784bd012888f39cf6.tar.xz hercules-79ea125f00a9655ee3aea7c784bd012888f39cf6.zip |
Merge pull request #1361 from HerculesWS/coverity-fixes
Fixed various issues reported by coverity
Diffstat (limited to 'src/map/guild.c')
-rw-r--r-- | src/map/guild.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/map/guild.c b/src/map/guild.c index ae3887aca..83afc9538 100644 --- a/src/map/guild.c +++ b/src/map/guild.c @@ -416,20 +416,18 @@ int guild_request_info(int guild_id) //Information request with event int guild_npc_request_info(int guild_id,const char *event) { - if( guild->search(guild_id) ) - { - if( event && *event ) + if (guild->search(guild_id) != NULL) { + if (event != NULL && *event != '\0') npc->event_do(event); return 0; } - if( event && *event ) - { + if (event != NULL && *event != '\0') { struct eventlist *ev; struct DBData prev; - ev=(struct eventlist *)aCalloc(sizeof(struct eventlist),1); - memcpy(ev->name,event,strlen(event)); + CREATE(ev, struct eventlist, 1); + safestrncpy(ev->name, event, sizeof(ev->name)); //The one in the db (if present) becomes the next event from this. if (guild->infoevent_db->put(guild->infoevent_db, DB->i2key(guild_id), DB->ptr2data(ev), &prev)) ev->next = DB->data2ptr(&prev); |