title: Pointer is null after returning from function call
body: <p>First off, I know this should have been answered somewhere on SO but I just can't seem to find the correct post. So if it is a duplicate please point me to the post that answers this question and I will delete this.</p>
  
  <p>I have a function that copies a string:</p>
  
  <pre><code>static int read_ad_content(json_t * root, char* content)
  {
  
    [.. stuff happens]
  
    const char* tmp = json_string_value(json_content);
    unsigned int size = strlen(tmp);
    content = (char*)malloc(size + 1);
    memcpy(content, tmp, size);
    content[size] = '\0'; // &lt;= I checked and content is NOT null here!
  
    return 0;
  }
  </code></pre>
  
  <p>And I call it like this in my main function:</p>
  
  <pre><code>char *ad_content;
  if (read_ad_content(ad_json, ad_content) != 0)
    {
       log_err(argv, "Failed to extract information");
    }
  
    if (ad_content == NULL)
    {
      // &lt;= I always end up here
    }
  </code></pre>
  
  <p>I know this should be easy but I just don't know how to solve this.</p>