<div dir="ltr">On 16 January 2014 05:37, Tapani Pälli <span dir="ltr"><<a href="mailto:tapani.palli@intel.com" target="_blank">tapani.palli@intel.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000"><div class="im">
    <div>On 01/15/2014 06:13 PM, Paul Berry
      wrote:<br>
    </div>
    </div><blockquote type="cite">
      
      <div dir="ltr"><div class="im">On 2 January 2014 03:58, Tapani Pälli <span dir="ltr"><<a href="mailto:tapani.palli@intel.com" target="_blank">tapani.palli@intel.com</a>></span>
        wrote:<br>
        </div><div class="gmail_extra">
          <div class="gmail_quote">
            <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="im">Signed-off-by: Tapani
              Pälli <<a href="mailto:tapani.palli@intel.com" target="_blank">tapani.palli@intel.com</a>><br>
              ---<br>
               src/mesa/main/shaderapi.c | 44
              ++++++++++++++++++++++++++++++++++++++------<br>
               1 file changed, 38 insertions(+), 6 deletions(-)<br>
              <br></div><div class="im">
              +   char *data = mesa_program_serialize(shProg,
              &size);<br>
              +<br>
              +   /* we have more data that can fit to user given buffer
              */<br>
              +   if (size > bufSize) {<br>
              +      _mesa_error(ctx, GL_INVALID_OPERATION,
              __FUNCTION__);<br>
              +      if (data)<br>
              +         free(data);<br>
            </div></blockquote><div class="im">
            <div><br>
            </div>
            <div>Why would we ever expect mesa_program_serialize to set
              size to a nonzero value but return NULL?  It seems like
              this could only happen if there's a bug, in which case
              this really ought to be<br>
              <br>
            </div>
            <div>assert(data !=NULL);<br>
              <br>
            </div>
            <div>Also, it's safe to call free() on a NULL pointer. 
              According to the C standard, freeing a NULL pointer does
              nothing.<br>
            </div>
          </div></div>
        </div>
      </div>
    </blockquote>
    <br>
    sure, will fix<div class="im"><br>
    <br>
    <blockquote type="cite">
      <div dir="ltr">
        <div class="gmail_extra">
          <div class="gmail_quote">
            <div> </div>
            <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
              +      return;<br>
              +   }<br>
              +<br>
              +   if (data) {<br>
            </blockquote>
            <div><br>
            </div>
            <div>Similarly, this if-statement is unnecessary.<br>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br></div>
    it is required for memcpy but not for free</div></blockquote><div><br></div><div>Oops, you're right.<br></div></div></div></div>