/simpletypesystem/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/simpletypesystem/trunk

« back to all changes in this revision

Viewing changes to src/SimpleTypeSystem.c

  • Committer: Gustav Hartvigsson
  • Date: 2013-09-05 18:47:23 UTC
  • mto: This revision was merged to the branch mainline in revision 7.
  • Revision ID: gustav.hartvigsson@gmail.com-20130905184723-dlyq9ql0udit638e
Made sure -- using valgrind -- that the SBaseObjectInstance and
SError implementations do not leak.

Woop!

Also: changed from malloc+strlen+strcpy to strdup in s_string_new ().

\0/
 |
/ \

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
}
26
26
 
27
27
char * s_string_new (const char * s) {
28
 
  char * ret_val = malloc (strlen (s) + 1);
29
 
  strcpy (ret_val, s);
 
28
  char * ret_val = strdup (s);
 
29
  free (s);
30
30
  return ret_val;
31
31
}
32
32
 
33
33
char * s_string_new_with_len (const char * s, size_t len) {
34
34
  char * ret_val = malloc (len + 1);
35
35
  strncpy (ret_val, s, len);
 
36
  free (s);
36
37
  return ret_val;
37
38
}
38
39