I'm assuming that count_breaks()
returns an int and not a pointer to int.
If that's the case, you could try to change your function to
int *linebreak(char *msg, int *breakn)
{
// count_breaks() should return an int
// and it should be assigned to the variable pointed by breakn
*breakn = count_breaks(msg);
// In C the return value of malloc should not be cast, in C++ is needed though
// You were casting breakn to int, instead of dereferencing it
int *arr = malloc(*breakn * sizeof(*arr));