Revision c81e8439

View differences:

som/Tests/chunk_encoding_test.c
5 5
 */
6 6

  
7 7
#include <stdint.h>
8
#include <stdlib.h>
8 9
#include <stdio.h>
9 10
#include <string.h>
10 11
#include "chunk.h"
......
38 39
  src_c.id = 666;
39 40
  src_c.timestamp = 1000000000ULL;
40 41
  src_c.size = strlen("ciao") + 1;
41
  src_c.data = (uint8_t *)"ciao";
42
  src_c.data = strdup("ciao");
42 43
  src_c.attributes_size = 0;
43 44

  
44 45
  chunk_print(stdout, &src_c);
......
49 50
  fprintf(stdout, "Encoding in 23 bytes: %d\n", res);
50 51
  res = encodeChunk(&src_c, buff, sizeof(buff));
51 52
  fprintf(stdout, "Encoding in %d bytes: %d\n", sizeof(buff), res);
53
  free(src_c.data);
52 54

  
53 55
  res = decodeChunk(&dst_c, buff, res);
54 56
  fprintf(stdout, "Decoding it: %d\n", res);
som/Tests/chunk_sending_test.c
97 97
    c.id = 666;
98 98
    c.timestamp = 1000000000ULL;
99 99
    c.size = strlen("ciao") + 1;
100
    c.data = (uint8_t *)"ciao";
100
    c.data = strdup("ciao");
101 101
    c.attributes_size = 0;
102 102

  
103 103
    dst = create_node(dst_ip, dst_port);
104 104
    sendChunk(dst, &c);
105
    free(c.data);
105 106
  } else {
106 107
    /* Receive a chunk and print it! */
107 108
    int res;

Also available in: Unified diff