Skip to content

Commit

Permalink
fix issue cloudwu#372
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudwu committed Nov 11, 2015
1 parent 7521fe0 commit 9f3baf2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion skynet-src/skynet_error.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ skynet_error(struct skynet_context * context, const char *msg, ...) {
va_start(ap,msg);
int len = vsnprintf(tmp, LOG_MESSAGE_SIZE, msg, ap);
va_end(ap);
if (len < LOG_MESSAGE_SIZE) {
if (len >=0 && len < LOG_MESSAGE_SIZE) {
data = skynet_strdup(tmp);
} else {
int max_size = LOG_MESSAGE_SIZE;
Expand All @@ -44,6 +44,11 @@ skynet_error(struct skynet_context * context, const char *msg, ...) {
skynet_free(data);
}
}
if (len < 0) {
skynet_free(data);
perror("vsnprintf error :");
return;
}


struct skynet_message smsg;
Expand Down

0 comments on commit 9f3baf2

Please sign in to comment.