Skip to content

Commit

Permalink
bug fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
urbach committed Dec 4, 2009
1 parent 047c20c commit 01d1da9
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions io/utils_read_message.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,19 @@

#include "utils.ih"

int read_message(READER * reader, char **buffer)
{
int read_message(READER * reader, char **buffer) {

int status;
n_uint64_t bytes, bytesRead;

if (buffer == (char**)NULL)
return(-1);

if ((*buffer) != (char*)NULL)
free(*buffer);

bytes = ReaderBytes(reader);
bytesRead = bytes;

*buffer = (char*)malloc(bytes + 1);

Expand All @@ -46,8 +47,8 @@ int read_message(READER * reader, char **buffer)

if (status != LIME_SUCCESS || bytes != bytesRead)
kill_with_error(reader->fp, g_cart_id, "Error in reading message.\n");
buffer[bytes] = '\0'; /* Force termination for safety */

return(0);

buffer[bytes] = '\0'; /* Force termination for safety */
return(0);
}

0 comments on commit 01d1da9

Please sign in to comment.