Ver código fonte

display/d.linegraph: fix generate graph image if 'x_title', 'y_title' param arg isn't defined (#1978)

* fix dynamic memory allocation if 'x_title', 'y_title' param arg isn't defined
Tomas Zigo 3 anos atrás
pai
commit
ed8195d493
1 arquivos alterados com 2 adições e 2 exclusões
  1. 2 2
      display/d.linegraph/main.c

+ 2 - 2
display/d.linegraph/main.c

@@ -889,7 +889,7 @@ int main(int argc, char **argv)
 
     /* draw the x-axis label */
     if ((strcmp(title[0]->answer, "") == 0) && (strcmp(tic_name, "") == 0))
-        *xlabel = '\0';
+        xlabel =  G_store("");
     else
         G_asprintf(&xlabel, "X: %s %s", title[0]->answer, tic_name);
     text_height = (b - t) * TEXT_HEIGHT;
@@ -1001,7 +1001,7 @@ int main(int argc, char **argv)
 
     /* draw the y-axis label */
     if ((strcmp(title[1]->answer, "") == 0) && (strcmp(tic_name, "") == 0))
-        *xlabel = '\0';
+        xlabel = G_store("");
     else
         G_asprintf(&xlabel, "Y: %s %s", title[1]->answer, tic_name);
     text_height = (b - t) * TEXT_HEIGHT;